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.