jQuery mCustomScrollbar "scrollTo" not working

Matt picture Matt · Jul 17, 2012 · Viewed 19.1k times · Source

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!

Answer

varunvlalan picture varunvlalan · Nov 29, 2012

MCustomScrollbar 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!