我是靠谱客的博主 欣喜棉花糖,这篇文章主要介绍jQueryRotate 使用 第一篇,现在分享给大家,希望可以做个参考。

需求如下:

让元素随中心转动当鼠标放上去则停止,鼠标移开,在停止位置继续旋转。


核心代码:

<script type="text/javascript">
$(function(){
var currentAngle = 0;
var rotation = null;
start();
$('#lotteryBtn').rotate({
bind : {
mouseover : function(){
stop();
}, mouseout : function(){
start();
}
}
});
function start(){
console.log("start"+currentAngle);
var angle = parseInt(currentAngle);
rotation = setInterval(function(){
angle +=3;
$('#lotteryBtn').rotate(angle);
}, 50);
}
function stop(){
currentAngle = $('#lotteryBtn').getRotateAngle();
clearInterval(rotation);
rotation = null;
}
});
</script>	

下载地址: http://download.csdn.net/detail/huaishuming/8118449

最后

以上就是欣喜棉花糖最近收集整理的关于jQueryRotate 使用 第一篇的全部内容,更多相关jQueryRotate内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(110)

评论列表共有 0 条评论

立即
投稿
返回
顶部