darkroomengineering / lenis

How smooth scroll should be
https://lenis.darkroom.engineering
MIT License
7.37k stars 317 forks source link

Lenis scroll can't reach the bottom on 2nd instance #197

Closed heyadeivan closed 1 year ago

heyadeivan commented 1 year ago

Hi everyoneđź‘‹

I tried to implement 2 instances of Lenis scroll on my website.

const lenis = new Lenis({
    duration: 1.8,
})

const lenis2 = new Lenis({
    duration: 1.8,
    content: document.querySelector('.smooth-scroll')
})

I applied lenis1 to the main page, and I can fix it by adding html { height:auto }

Next I applied lenis2 for the popup section. You can open it in the "SELECTED WORK" menu, and there I see that the scroll is unable to reach the bottom of the page, how to solve this?

Here is the website link (where you can see what I mean) : https://try.adeivan.com

https://github.com/studio-freight/lenis/assets/75879157/1fcc2659-af4e-421e-a77d-9dead448bb64

clementroche commented 1 year ago

you need to provide both wrapper and content elements

const lenis2 = new Lenis({
   wrapper: document.querySelector('.smooth-scroll')
    content: document.querySelector('.smooth-scroll-content')
})
heyadeivan commented 1 year ago

Ahh Solved!, thanks

you need to provide both wrapper and content elements

const lenis2 = new Lenis({
   wrapper: document.querySelector('.smooth-scroll')
  content: document.querySelector('.smooth-scroll-content')
})