我想讓它的滾動鼠標懸停在圖像上,但只能滾動到目前爲止。某處它只是不太工作JavaScript滾動對象由mouseover
$(document).ready(function()
{
$('#test').bind('mouseenter', function()
{
var self = $(this);
var right = parseInt(self.style.left) || 200;
this.iid = setInterval(function()
{
if (right <= 400)
{
right += 200;
}
else
{
right = 400;
}
self.style.left = right + "px";
}, 525);
}).bind('mouseleave', function()
{
this.iid && clearInterval(this.iid);
});
});
#test {
color:white;
width: 400px;
height: 400px;
left: 200px;
background-color: #000;
position: absolute;
}
<div id="test">hover me please</div>
或這裏小提琴: http://jsfiddle.net/qjxqC/1/
感謝您幫助
其中是處理滾動事件的函數? – palerdot