>  기사  >  웹 프론트엔드  >  jquery는 animate 메서드를 사용하여 요소 movement_jquery를 제어합니다.

jquery는 animate 메서드를 사용하여 요소 movement_jquery를 제어합니다.

WBOY
WBOY원래의
2016-05-16 16:07:211526검색

이 문서의 예에서는 jquery가 애니메이션 메서드를 사용하여 요소의 이동을 제어하는 ​​방법을 설명합니다. 참고할 수 있도록 모든 사람과 공유하세요. 구체적인 분석은 다음과 같습니다.

jquery의 애니메이션 메서드를 통해 요소의 이동을 제어합니다. 여기서 요소의 위치를 ​​상대, 고정 또는 절대로 정의해야 합니다!

<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("div").animate({left:'250px'});
 });
});
</script>
</head>
<body>
<button>Start Animation</button>
<p>By default, all HTML elements have a static position,
and cannot be moved. To manipulate the position, 
remember to first set the CSS position property 
of the element to relative, fixed, or absolute!</p>
<div style="background:#98bf21;
height:100px;width:100px;position:absolute;">
</div>
</body>
</html>

이 기사가 모든 사람의 jQuery 프로그래밍에 도움이 되기를 바랍니다.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.