mCustomScrollbar get scroll position

18,208

Solution 1

Look at callbacks example - there is Scroll percentage that displays % of scrolled. Open HTML source and you will see that it's uses whileScrolling callback: $("#mcs-top-pct").text(this.mcs.topPct+"%");, so when this.mcs.topPct is 100, then container is scrolled to bottom :)

Solution 2

I used to myself something like:

$('#someElement').mCustomScrollbar({theme: "minimal"});

and after, you can get scrollTop using this code:

var scrollTop = $('#someElement').find(".mCSB_dragger").position().top;

Share:
18,208
freakydev
Author by

freakydev

Updated on June 04, 2022

Comments

  • freakydev
    freakydev almost 2 years

    Iam using mCustomScrollbar , I want to know whether my scroll bar position is at bottom using jquery.How is that possible?Can i use ordinary bottom check usage in jquery or any functions are available in the mCustomScrollbar library?