你好,我有自動滾動頁面的工作代碼。我需要做一些修改。當用戶在頁面上移動鼠標並且沒有鼠標移動時,需要暫停自動滾動,然後自動滾動將恢復。當用戶將鼠標移動到屏幕/圖形上時,自動滾動將暫停。如果鼠標移動停止,自動滾動將再次恢復
<script>
$("html, body").animate({ scrollTop: $(document).height() }, 400000);
setTimeout(function() {
$('html, body').animate({scrollTop:0}, 400000);
},400000);
setInterval(function(){
// it will take 40 secound in total from the top of the page to the bottom
$("html, body").animate({ scrollTop: $(document).height() }, 400000);
setTimeout(function() {
$('html, body').animate({scrollTop:0}, 400000);
},400000);
},8000);
</script>
請更新html或給我們一個FIDDLE以獲得適當的幫助.. – Sarath
http://stackoverflow.com/questions/5088766/the-way-to-stop-and-continue-animation-while-mouseover-and -mouseout-in-jquery –
@Sarath http://jsfiddle.net/QUCWe/1605/ –