-
-
Notifications
You must be signed in to change notification settings - Fork 303
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to prevent scroll #334
Comments
hi @mickaelchanrion, good idea ! Do you know if these modals always use the same classes ? |
Hi Clement, type LenisOptions = {
// ...
preventScroll?: string[] | (node: Element) => boolean
} |
hey @mickaelchanrion what service provides this cookie modal and what class is used ? I wanna provide an example in the documentation |
@mickaelchanrion should be available in v1.1.0 |
@clementroche Great news!! Regarding your question, you can open this link: https://www.cookieyes.com/ After checking the v1.1.0, a correct example could be: new Lenis({
prevent: (node) => node.classList.contains('cky-modal')
}) |
Exact @mickaelchanrion, does it suits your needs ? If so i'm closing this issue. |
Hi there 馃憢
data-lenis-prevent
is very useful to allow nested scroll but in some peculiar cases, we don't have the control over an element that is expected to be scrollable so no way to add this attribute.Here is an example: a third party cookie modal for fine grained controls.
In this situation this element is generated by their script and they do not provide events on modal triggering so I don't really see how I can add the attribute. Here is a solution I could think of:
I can propose a PR for that :)
The text was updated successfully, but these errors were encountered: