Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options to limit outer scroll space #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daelmaak
Copy link

@daelmaak daelmaak commented Jun 14, 2018

This PR fixes #33

Basically it allows the user to configure two additional boolean options scrollWhenOutsideX and scrollWhenOutsideY to limit which pointer position outside of the scrollable element is permitted to scroll it.

By setting first scrollWhenOutsideX and secondly scrollWhenOutsideY to false, the limitations then look like this
outside_zones
where only dragging in the green zones is able to scroll in the div. This stays in opposition to configuring setting just scrollWhenOutside, where the complete rectangle around the div is permitted to scroll in that div.

This solves the problem of two scrollable divs next to each other while dragging and drag-scrolling between them.
2_scroll_containers
Without the fix, if one drags from 1 to the orange areas in 2, it scrolls both of them because the outside scrollable area of 1 isn't confined to its "natural" axis. With the fix, by specifying eg.
{ scrollWhenOutsideX: false, scrollWhenOutsideY: true }
the div nr. 1 can be only scrolled by dragging to one of the yellow areas.

Note, that I leave the scrollWhenOutside option there for compatiblity reasons and all those 3 are complementary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple autoscrolling divs scrolled at once
1 participant