国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

jquery使用animate方法實現控制元素移動

2024-05-06 16:17:40
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了jquery使用animate方法實現控制元素移動,涉及jQuery中animate方法的使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了jquery使用animate方法實現控制元素移動。分享給大家供大家參考。具體分析如下:

通過jquery的animate方法控制元素移動,這里需要將元素的位置定義為relative, fixed, 或者 absolute!

 

 
  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <script src="js/jquery.min.js"
  5. </script> 
  6. <script> 
  7. $(document).ready(function(){ 
  8. $("button").click(function(){ 
  9. $("div").animate({left:'250px'}); 
  10. }); 
  11. }); 
  12. </script> 
  13. </head> 
  14. <body> 
  15. <button>Start Animation</button> 
  16. <p>By default, all HTML elements have a static position, 
  17. and cannot be moved. To manipulate the position,  
  18. remember to first set the CSS position property  
  19. of the element to relative, fixed, or absolute!</p> 
  20. <div style="background:#98bf21; 
  21. height:100px;width:100px;position:absolute;"> 
  22. </div> 
  23. </body> 
  24. </html> 

希望本文所述對大家的jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 金溪县| 宁夏| 沭阳县| 伊宁县| 绩溪县| 阳朔县| 彰武县| 靖西县| 漠河县| 林甸县| 天祝| 南康市| 华蓥市| 吉林市| 德格县| 奉化市| 巨鹿县| 沁源县| 武鸣县| 石林| 吉林省| 疏勒县| 林芝县| 绥江县| 苍溪县| 德令哈市| 和顺县| 湾仔区| 中江县| 万盛区| 寿宁县| 永寿县| 五河县| 元谋县| 江北区| 西丰县| 玉环县| 陆川县| 镇沅| 和静县| 临西县|