Laravel User
Laravel User

Reputation: 1129

How to get scroll event of element which has mCustomScrollbar used?

I have a div on which i have used mCustomScrollbar js library, now i need to get the scroll event of this div.

Can anyone help me on this ?

here is the code i have used to set mCustomScrollbar on div.

<div id="content"></div>
<script>
$('#content').mCustomScrollbar();
</script>

Upvotes: 1

Views: 1241

Answers (2)

user6446579
user6446579

Reputation:

just use mcustomscrollebar library event of getting scroll event , you can see it on site.

Upvotes: 0

se0kjun
se0kjun

Reputation: 550

you can use MutationObserver

Following this code

var observer = new MutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
    console.log($(mutation.target).css('top'));
  });    
});

observer.observe(document.getElementById('mCSB_1_container'), { attributes : true, attributeFilter : ['style'] });

Here's a fiddle

Upvotes: 1

Related Questions