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

locomotive scroll == no dialog windows? #519

Open
piscopancer opened this issue Sep 21, 2023 · 5 comments
Open

locomotive scroll == no dialog windows? #519

piscopancer opened this issue Sep 21, 2023 · 5 comments
Labels

Comments

@piscopancer
Copy link

When I attempt to change an element to be scrolled by the locomotive it just does not work. I could see a workaround on the v5 docs using event listeners for a wheel, but it's such a mess I could not imagine writing this in my own app.

I also tried below code in Lenis before, same thing. There is absolutely no reaction from these libraries whatsoever 😕.

export function LocomotiveScroll() {
	const { locomotive, locomotiveContainer } = useGlobalSnapshot()

	useEffect(() => {
		store.locomotive = ref(new Locomotive())
	}, [])

	useEffect(() => {
		locomotive && store.locomotive!.destroy()
		store.locomotive = ref(new Locomotive({ el: locomotiveContainer || undefined }))
	}, [locomotiveContainer])

	return <></>
}

My question is simple: how do you work with dynamic elements popping up, eg dialogs, modals? I have no idea why destroying and isntance and recreating it with an el set to the dialog scrollable container has no reaction 😕.

@devenini
Copy link
Member

devenini commented Oct 5, 2023

Hey! Have you tried to either add data-lenis-prevent on the dialog popup or to use our workaround?

@devenini devenini added the v5 label Oct 5, 2023
@piscopancer
Copy link
Author

@devenini hey. data-lenis-prevent - I did not know that, where do I use that 🤔?

@devenini
Copy link
Member

devenini commented Dec 2, 2023

Hey! Sorry for the late reply. To prevent the scroll event from being caught by Lenis, you can add data-lenis-prevent to a div. This is typically used for elements like modals, popups, or nested scroll elements.

@tariknh
Copy link

tariknh commented Jan 15, 2024

hey looks like you are using nextjs, i made a fix for the v5 where you can just implement this #506 (comment)

Thats all there is to it. I got it working for app router next 14. If you have questions let me know

@tschelovek
Copy link

Hey! Have you tried to either add data-lenis-prevent on the dialog popup or to use our workaround?

Thank you! This helped me to fix scrolling my mobile burger menu. Searching in documentation I've just skipped "Third Party Injected..." so didn't find solution myself.

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

No branches or pull requests

4 participants