0

I have used jquery custom scroll bar plugin to show the custom scroll bar. Link

It works fine in all browser and devices but There is one strange issue. Although It works fine in IE as well but scroll bar is visible while scrolling is not required. I have also used call back function (onOverflowYNone) to remove this but it will remove scroll functionality. How can I remove the scroll if the ratio is near about 1.

mjdevloper
  • 1,553
  • 8
  • 33
  • 69

1 Answers1

0

You could potentially do the following:

/*CSS*/
.hidden { display: none; }

// jQuery
$(document).ready(function() {
    $(window).resize(function() {
        var windowHeight = $(this).height();
        var containerHeight = $(".<container-class>").height(); //<container-class> is just a placeholder. Your real class should go here.
        if (containerHeight <= windowHeight) {
            $(".mCustomScrollbar").addClass("hidden"); // This is the example default class that was in the link you provided
        } else {
            $(".mCustomScrollbar").removeClass("hidden");            
        }
    });
});

This will wait for the document to load and then attach a resize action listener that will, at any point when the window is resized, run this check to see the dimensions of the window and the container. You could also externalize this check and add it to more action listeners, if you like.

Obviously, you should tailor the evaluation to meet your needs, but the core concept remains intact.

Blake Neal
  • 325
  • 4
  • 13