Skip to content

Next JS + Loco v5 has some jumps and bottom cuttof #559

Open
@Ahlecss

Description

Hi !

I hope you are doing well,

I'm experiencing some bugs with Nextjs 14,

I have long pages, with some images, and regularly, I have some jumps from bottom to mid page,
Also, the scroll can't goes to the bottom of the page.

I'm using this code that reruns Loco on each time the current page changes, thanks to the new pathname hooks.

useEffect(() => {
        (async () => {
            const LocomotiveScroll = (await import('locomotive-scroll')).default;
            loco.current = new LocomotiveScroll({})
        }
        )()
    }, [pathname])

I've read here and there that triggering a "Resize" event could do the work, but it's seems to work randomly.

I've tried to do something like :

window.addEventlistener('DOMContentLoaded', () =>{ loco.current.update() })

But the event is never firing neither.

Plus, I saw that loco.update() is a function that could resolve some things, but I doesn't even exist.

Do you have any on how to resolve that ?

Thanks,
Have a great day !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions