jQuery animate scroll

2019-01-13 01:37发布

I'm not sure how to call the effect, but can someone point me into a library that would help me do the same effect as this website?

http://www.makr.com

Basically, it moves up the row to the top of the page on mouse click. A code snippet, preferably jQuery, can help to, if there is no such specialized effect library for it.

Im not sure if i need to start another topic, but can anyone help me with a small jQuery snippet to achieve the whole effect of the Makr UI?

4条回答
Animai°情兽
2楼-- · 2019-01-13 01:47

You can animate the scrolltop of the page with jQuery.

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

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

查看更多
SAY GOODBYE
3楼-- · 2019-01-13 01:56

You can also try a simple jquery plugin (AnimateScroll) developed by me which was well appreciated by many!

查看更多
forever°为你锁心
4楼-- · 2019-01-13 01:58

I just use:

$('body').animate({ 'scrollTop': '-=-'+<yourValueScroll>+'px' }, 2000);

查看更多
别忘想泡老子
5楼-- · 2019-01-13 02:02

There is a jquery plugin for this. It scrolls document to a specific element, so that it would be perfectly in the middle of viewport. It also supports animation easings so that the scroll effect would look super smooth. Check out AnimatedScroll.js.

查看更多
登录 后发表回答