malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.51k forks source link

Jquery scroll function not working. #265

Open ghost opened 9 years ago

ghost commented 9 years ago

Hi Malihu, I like your plugins so much and i used your plugins in our website. but 1 problem i face...

when i use your plugin for body tag, its working well. but when i use it, my another custom $(window).scroll() function is not working.

what can i do?

please help!!!

malihu commented 9 years ago

Hello,

$(window).scroll() function works only with browser's default scrollbar.

The custom scrollbar plugin provides methods/events for doing the same thing (and much more) in your script(s). For example, you can use the onScroll callback like this:

$(selector).mCustomScrollbar({
    callbacks:{
        onScroll:function(){
          console.log("content scrolled...");
        }
    }
});

There are more than one callbacks available and you can see a list of them here: http://manos.malihu.gr/jquery-custom-content-scroller/#configuration-section

Also there's a mini guide on using them here: http://manos.malihu.gr/jquery-custom-content-scroller/#callbacks-section

ghost commented 9 years ago

Hi, Thank you. Your solution is working good. But

  1. how can i get screen width/height and document width/height in whilescrolling callbacks?
  2. i already run a function on body tag, how can i run second function on body?

eg: i m using angularjs directive. in "firstdir" directive i already use your function in body tag. now in "seconddir" directive i need to run another scroll function on body tag?

How can i do it?

Please help...

malihu commented 9 years ago
  1. With standard jQuery, e.g. $(window).width(), $(document).height() etc.
  2. You can call as many functions as you like in the callback. For example:
onScroll:function(){
    doThis();
    doThat();
}

function doThis(){
    /* code */
}

function doThat(){
    /* code */
}
prabugovindaraj commented 8 years ago

HI, I like this plugin. but If i have 1000 lines of data then mouse scroll is not working.

any solution?

malihu commented 8 years ago

@prabugovindaraj

I haven't experienced such issue before. I've made tests with content over 30000 pixels long and everything worked as expected...

Have you tried setting a fixed scrolling amount for the mouse-wheel? For example: mouseWheel:{ scrollAmount: 60 }

prabugovindaraj commented 8 years ago

HI, Thanks for reply.

still it is not working. Note: version - 2.3.2

malihu commented 8 years ago

Are you using version 2.3.2 of custom scrollbar plugin? This is way too old!

prabugovindaraj commented 8 years ago

I tried with 3.1 then also not working

malihu commented 8 years ago

I need more info. Does this happen on specific browser(s)/OS? I cannot replicate this issue with 60000, 70000 or whatever amount of pixels. Can you send me a test page using latest plugin version where this happens?

prabugovindaraj commented 8 years ago

Hi, version 3.1 is working in normal DOM. I am using in dropdown. when mouse scroll time it's working but if i dragged with mCSB_dragger then mouseup dropdown is hiding. this problem not coming in 2.3

Please verify it

malihu commented 8 years ago

Send me a test page or jsFiddle with your implementation.