2013-09-05 3 views
0

여기에 표시된 스크립트는 링크에서 작동하지만 웹 사이트에 넣을 때 작동하지 않습니다. 무엇이 잘못 되었습니까? http://jsfiddle.net/QUCWe/자동 스크롤 스크립트가 작동하지 않습니다.

//<![CDATA[ 
$(window).load(function(){ 
function scroll(speed) { 
    $('html, body').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() { 
     $(this).animate({ scrollTop: 0 }, speed); 
    }); 
} 

speed = 1000; 

scroll(speed) 
setInterval(function(){scroll(speed)}, speed * 2); 
});//]]> 
+0

jQuery가 없다고 생각합니다. 콘솔이란 무엇입니까? – Krzysiek

+0

jquery가 있습니다 (예 :이 항목의 다른 코드). 위의 코드 만 작동하지 않습니다. \t http://stackoverflow.com/questions/8107251/automatically-scroll-page-from-top-to-bottom-then-back-up-and-repeat –

+2

'$ (window) .load (function ()'with $ (function()' – Krzysiek

답변

0

i 속도 * 2 변경 및 작동;

//<![CDATA[ 
$(window).load(function(){ 
function scroll(speed) { 
    $('html, body').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() { 
     $(this).animate({ scrollTop: 0 }, speed); 
    }); 
} 

speed = 1000; 

scroll(speed) 
setInterval(function(){ 
scroll(speed) 
}, 3000); 
});//]]> 
관련 문제