mb-scrollbar
mb-scrollbar copied to clipboard
Nested Scrolling
Got any ideas on this? I'm testing some use cases right now. You'd probably want to mimic native scrolling functionality by making the deepest object scroll, and prevent propagation upward.
No ideas off the top of my head. I'll think on it!
I came up with the following, but it's pretty expensive. Maybe you guys find a way to cache the closest element:
child.on('mousewheel', function(event) {
event.preventDefault();
// TODO find a way to cache this selection
if( child.is(angular.element(event.target).closest('.ngscroll-container')) ) {
// If jQuery hid the original event, retrieve it
var e = event.originalEvent || event;
var delta = ifVertElseHor(e.wheelDeltaY || e.wheelDelta, e.wheelDeltaX || e.wheelDeltaY || e.wheelDelta);
scroll( delta );
}
});
What if we stop the event propogation if srollbar is required to be moved.The possible code could be:
child.on('mousewheel', function(event) {
event.preventDefault();
// If jQuery hid the original event, retrieve it
if( event.originalEvent != undefined )
event = event.originalEvent;
var delta = ifVertElseHor(event.wheelDeltaY || event.wheelDelta, event.wheelDeltaX || event.wheelDeltaY || event.wheelDelta);
scroll( delta,event );
if(containerSize < length) // if scrollBar is present then parent scrollbar should not move
event.stopPropagation();
});
I have issue like this ,,, any ideas ??
The code mentioned by me above solved my problem. Please try that fragment and comment if that solved your problem.
its work ,cool 👍