jquery求指点 我写了一个setInterval 但是想hover停止,mouseout继续,求指点
下面我写好了,但是mouseout不能继续,求指点
<div class="div1">1</div>
$(document).ready(function() {
picTimer = setInterval(function()
{showPic();},1000); function showPic() {
$(".div1").animate({marginTop:"40px"},500);
$(".div1").animate({marginTop:"-40px"},500);
} $(".div1").hover(
function() {
clearInterval(picTimer);
}
,function(){
}
);
});
下面我写好了,但是mouseout不能继续,求指点
<div class="div1">1</div>
$(document).ready(function() {
picTimer = setInterval(function()
{showPic();},1000); function showPic() {
$(".div1").animate({marginTop:"40px"},500);
$(".div1").animate({marginTop:"-40px"},500);
} $(".div1").hover(
function() {
clearInterval(picTimer);
}
,function(){
}
);
});
解决方案 »
- thickbox点击按钮弹出层的问题
- js中正则表达式语法KPI(年统计|2011-04-15 18:49:04|qqq|www|eee|rrr|ttt|yyy|uuu)
- SELECT下拉框的空白大小的控制
- ------在先客服实现原理。
- 各位前辈,想问一下动态创建table标记方面的问题
- 鼠标所在点对应于所属文档的位置
- 奇怪的form.submit()的问题,急,谢谢!
- jquery $.ajax() 应用中的一点困惑,望高手点拨
- 当字符串中包含html标签,怎么避免标签匹配混乱? 100分,谢谢
- 一个小问题,关于赋初值的问题,五十分重谢!
- 我是新手,想在网页中调用另外一个网页,如何实现??
- iframe滚动条问题
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk" />
<title></title>
<style>
div {
position:absolute; left:200px; top:200px;
border:1px solid red;
width:20px; height:20px;
}
</style>
</head>
<body>
<div class="div1">1</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
picTimer = setInterval(showPic, 1000); function showPic() {
$(".div1").animate({marginTop:"40px"},500);
$(".div1").animate({marginTop:"-40px"},500);
} $(".div1").mouseover(function(){
$(this).stop();
clearInterval(picTimer);
}).mouseout(function(){
picTimer = setInterval(showPic, 1000);
})
});
</script>
</body>
</html>这个意思?