[JavaScript] JavaScript实现匀速运动和变速(缓冲)运动 →→→→→进入此内容的聊天室

来自 , 2020-07-25, 写在 JavaScript, 查看 141 次.
URL http://www.code666.cn/view/bcb7c13f
  1. var timer=null;
  2.  
  3. function startMove()
  4. {
  5.  
  6. var oDiv=document.getElementById('div1');
  7. clearInterval(timer);
  8. timer=setInterval(function () {
  9. var iSpeed=1;
  10.  
  11. if(oDiv.offsetLeft>=300)
  12. {
  13. clearInterval(timer);
  14. }
  15. else
  16. {
  17. oDiv.style.left=oDiv.offsetLeft+iSpeed+'px';
  18. }
  19. },30);
  20. };
  21.  
  22.  
  23.  
  24. //javascript/6515

回复 "JavaScript实现匀速运动和变速(缓冲)运动"

这儿你可以回复上面这条便签

captcha