admin管理员组文章数量:1391977
I'm using the nanoScoller.js plugin to create custom scrollbars on a website. This works fine except it would be nice if it could perform some kind of easing / smooth scrolling. The plugin doesn't seem to have an option for this, I was wondering is there any other way this can be achieved?
$('.nano').nanoScroller({
alwaysVisible: true
});
I'm using the nanoScoller.js plugin to create custom scrollbars on a website. This works fine except it would be nice if it could perform some kind of easing / smooth scrolling. The plugin doesn't seem to have an option for this, I was wondering is there any other way this can be achieved?
$('.nano').nanoScroller({
alwaysVisible: true
});
Share
Improve this question
asked Mar 30, 2014 at 14:47
MAX POWERMAX POWER
5,45816 gold badges98 silver badges146 bronze badges
2 Answers
Reset to default 5In case you want to use nanoScrollbar and still want to animate scroll, you can animate the content's default (browser) scrollbar and nanoScrollbar will animate the emulated slider as it listens to scroll events of content.
Below is the code for animating scroll to bottom
var el = $('.nano-content');
el.animate({ 'scrollTop': el[0].scrollHeight }, 'slow');
Hope this helps people who are looking for alternative solution.
nanoScroller uses native scrolling behavior, it does not emulate it. So, if browser does not support smooth scrolling, nanoScroller does not support it too. To make smooth scrolling you have to use custom scrollbar that emulates scrolling with animation/easing. There is a lot of scrollbar plugins that emulates scrolling (and supports scroll animation): jScrollPane, Malihu Custom Scrollbar, Perfect Scrollbar, slimScroll and others. You can check this document to pare scrollbars and select the one you need. Look at scrollbars with type "emulator"
本文标签: javascriptnanoScrollerjs with smooth scrollingStack Overflow
版权声明:本文标题:javascript - nanoScroller.js with smooth scrolling - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744668132a2618657.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论