mb-scrollbar icon indicating copy to clipboard operation
mb-scrollbar copied to clipboard

Nested Scrolling

Open tannerlinsley opened this issue 10 years ago • 6 comments

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.

tannerlinsley avatar Nov 13 '14 16:11 tannerlinsley

No ideas off the top of my head. I'll think on it!

mattbalmer avatar Nov 19 '14 01:11 mattbalmer

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 );
    }

});

LucidityDesign avatar Feb 23 '15 17:02 LucidityDesign

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();
        });

arshdefoamed avatar Sep 07 '15 06:09 arshdefoamed

I have issue like this ,,, any ideas ??

tonoyandev avatar Jan 04 '17 13:01 tonoyandev

The code mentioned by me above solved my problem. Please try that fragment and comment if that solved your problem.

arshdefoamed avatar Jan 04 '17 16:01 arshdefoamed

its work ,cool 👍

tonoyandev avatar Jan 07 '17 21:01 tonoyandev