admin管理员组文章数量:1208155
I'm using a basic setup for mCustomScrollbar
which is working great except when I call the following:
jQuery("#mcs_container").mCustomScrollbar("scrollTo","top");
Nothing happens. There is not error shown in firebug, it just does nothing. Has anyone experienced this before or does anyone have any idea why this might be happening?
Thanks!
I'm using a basic setup for mCustomScrollbar
which is working great except when I call the following:
jQuery("#mcs_container").mCustomScrollbar("scrollTo","top");
Nothing happens. There is not error shown in firebug, it just does nothing. Has anyone experienced this before or does anyone have any idea why this might be happening?
Thanks!
Share Improve this question edited Aug 4, 2021 at 23:07 Medulla Oblongata 3,96110 gold badges49 silver badges86 bronze badges asked Jul 17, 2012 at 9:11 MattMatt 891 gold badge1 silver badge10 bronze badges 2- Did you solve your problem? mine not working too – Loïc Faure-Lacroix Commented Nov 13, 2012 at 14:18
- 2 It's kinda lame, I finally got it to work. The css was getting loaded and I guess it prevented it to calculate correctly some dimensions. – Loïc Faure-Lacroix Commented Nov 19, 2012 at 18:29
6 Answers
Reset to default 10MCustomScrollbar doesn't provide feature of scrolling to top of the page. However, it does support scrolling to specific element in HTML.
For example, if I have an element with id "logout" which is at top of the page and i need to scroll at top, then write
$("#mcs_container").mCustomScrollbar("scrollTo", "#logout");
Hope you find this useful.
Cheers!
I had the same problem and solved it simply with calculating the position of my first element and scrolling to that number
After searching for a day. Here's what I got:
Tested and working (2019): $('.demo-yx').mCustomScrollbar('scrollTo',['top',null]);
From this link. Cheers!
I use like this, it'is working!
// set scrollbar
$('.scroll-y').mCustomScrollbar({
theme: 'minimal-dark'
});
// then set scrollTo
$('.scroll-y').mCustomScrollbar('scrollTo', 'bottom');
setTimeout( function () {
$("#mcs_container").mCustomScrollbar('scrollTo','last');
}, 100);
Use with time out
You just need a mCustomScrollbar class..... Here is your answer...
$(".scroller-back").mCustomScrollbar("scrollTo",jQuery("#mcs_container"));
本文标签: javascriptjQuery mCustomScrollbar quotscrollToquot not workingStack Overflow
版权声明:本文标题:javascript - jQuery mCustomScrollbar "scrollTo" not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738752565a2110483.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论