这个鼠标放到一个位置就一直在动
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<style>
div {
width: 500px;
height: 50px;
padding: 5px;
margin: 5px;
float: left;
border: 1px solid #ccc;
}
.left {
background: #bbffaa;
}
button{
width:200px;
height:100px;
}
#q1{
top:200px;
}
#q2{
top:160px;
}
.right {
background: yellow;
display: none;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<h2>通过toggle切换显示与隐藏</h2>
<div class="left">显示到隐藏</div>
<div class="right">隐藏到显示</div>
<button id="q1">直接show-hide动画</button>
<button id="q2">直接hide-show动画</button>
<script type="text/javascript">
$("button:first").mousemove(function() {
$(".left").toggle({
duration:3000,
complete:function(){
$(this).css('width','800px'
)
}
})
});
</script>
<script type="text/javascript">
$("button:last").mousemove(function() {
$(".right").toggle(3000)
});
</script>
</body>
</html>