手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery使用animate方法实现控制元素移动
jquery使用animate方法实现控制元素移动
摘要:本文实例讲述了jquery使用animate方法实现控制元素移动。分享给大家供大家参考。具体分析如下:通过jquery的animate方法控...

本文实例讲述了jquery使用animate方法实现控制元素移动。分享给大家供大家参考。具体分析如下:

通过jquery的animate方法控制元素移动,这里需要将元素的位置定义为relative, fixed, 或者 absolute!

<!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> </div> </body> </html>

希望本文所述对大家的jQuery程序设计有所帮助。

【jquery使用animate方法实现控制元素移动】相关文章:

jquery插件validation实现验证身份证号等

jQuery实现弹出窗口中切换登录与注册表单

jQuery聚合函数实例

jquery实现用户打分评分特效

jQuery插件jRumble实现网页元素抖动

javascript实现可拖动变色并关闭层窗口实例

Jquery使用val方法读写value值

Jquery使用css方法改变样式实例

浅谈jQuery中replace()方法

jquery读取xml文件实现省市县三级联动的方法

精品推荐
分类导航