最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Animating windows.scrollby in Javascript - Stack Overflow

programmeradmin4浏览0评论

So im using the window.scrollby like this

<script> 
function scrollWindowup()   {  
 window.scrollBy(0,700)   
 }  
 function scrollWindowdown()   { 
 window.scrollBy(0,-700)   }
 </script>

is there any way to animate it like move slowy or an offset or any other option ?

thanks in advance

So im using the window.scrollby like this

<script> 
function scrollWindowup()   {  
 window.scrollBy(0,700)   
 }  
 function scrollWindowdown()   { 
 window.scrollBy(0,-700)   }
 </script>

is there any way to animate it like move slowy or an offset or any other option ?

thanks in advance

Share Improve this question edited Oct 16, 2012 at 7:02 user1749105 asked Oct 16, 2012 at 6:15 user1749105user1749105 971 gold badge2 silver badges8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 15

From a similar question...

You can animate the scrolltop of the page with jQuery.

$('html, body').animate({
    scrollTop: $(".middle").offset().top
 }, 2000);

Or

$('html, body').animate({
    scrollTop: 700
 }, 2000);

Animating down a page:

$('html, body').animate({
    scrollTop: '+=700'
 }, 2000);

Animating up a page:

$('html, body').animate({
    scrollTop: '-=700'
 }, 2000);

See this site: http://papermashup./jquery-page-scrolling/

发布评论

评论列表(0)

  1. 暂无评论