标签:++ code div log gets attr att blog val
//抖动函数, 对象,频率,属性(上下,左右) function shake(obj,rate,attr){ var arr = []; var timer = null; var num = 0; var pos = parseInt(getStyle(obj,attr)); for (var i=0; i<rate; i-=2) { arr.push(i,-i); } arr.push(0); clearInterval(timer); obj.timer = setInterval(function(){ obj.style[attr] = pos + arr[num] + ‘px‘; num++; if (num == arr.length) { clearInterval(obj.timer); } endFn && endFn(); },50); }
标签:++ code div log gets attr att blog val
原文地址:http://www.cnblogs.com/zyq562550692/p/6820219.html