I'm trying to prevent the browser window to scroll if I've reached the top or bottom of my jscrollpane div. Tinyscrollbar does that.
with jscrollpane I can detect the div scrolling with something like that:
var jsp = $(".scroll-pane").data('jsp'); // getting hold of the api
jsp = $("#" + e.attr('id') + " > .feed-items").bind(
'jsp-scroll-y', function(e, scrollPositionY, isAtTop, isAtBottom) {
// reached bottom
if (jsp.getPercentScrolledY() == 1) {
} else {
// ...
}
})
I tried using e.preventDefault()
and it didn't work. I tried everything in my magic box, from returning false to stopping propagation. Nothing works. There was this nice hack:
$("body").css("overflow", "hidden")
.css('margin-left', "-" + __scrollbarWidth + "px");
But I don't want to use this as it's not perfect.
Any ideas?