timer = setInterval(mar,30);
//鼠标移上去清除时钟
box.onmouseover = function(event){
clearInterval(timer);
event.stopPropagation();
//这里是阻止冒泡,不加要冒泡到body上面,鼠标在body上面就会clearInterval(timer);
box.onmouseout = function(event){
timer = setInterval(mar, 30);
event.stopPropagation();
}
};
//用jq方式写
/*$(box).on('mouseover',function(){
clearInterval(timer);
})*/
// $(box).mouseover(function(event){
// clearInterval(timer);
// event.stopPropagation();
// $(box).mouseout(function(e){
// timer = setInterval(mar,30);
// e.stopPropagation();
// })
// });
posted on 2017-05-15 14:25  webstrom10  阅读(748)  评论(1编辑  收藏  举报