Jump to content
Search Community

Lenis Smooth Scroll Issue with Iframe Interaction (Scroll and Drag Problems)

Mohamed Hassan
Moderator Tag

Recommended Posts

Mohamed Hassan
Posted

Hi everyone,

I'm working on a project that uses Lenis smooth scrolling on the main page, but I'm running into issues when trying to interact with an iframe on the page. Specifically, I want to be able to smoothly scroll through the page while still allowing full interaction with the iframe, such as scrolling inside the iframe or dragging content within it.

 

The Problem:

  • The page scrolls smoothly using Lenis, but when the user tries to scroll or drag inside the iframe, the scrolling doesn’t work properly.
  • The iframe content becomes unscrollable, and the smooth scrolling sometimes interferes with the iframe’s native scrollability.
  • I want the user to be able to scroll smoothly on the main page but still interact with the iframe’s contents normally.

    here is the project: reline-studio.webflow.io
Posted

Without a minimal demo, it's very difficult to troubleshoot; Keep in mind Lenis is not a GSAP product, so we cant provide support of third party plugins. The issue could be caused by CSS, markup, a third party library, a 3rd party script, etc. Would you please provide a very simple CodePen or Stackblitz that illustrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependencies as possible. Start minimal and then incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen.

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Posted

There is one attribute for Lenis scroll data-lenis-prevent. Kindly use it in you iframe's container. This might be help you.

Note:- add exact location of the issue for example page or any specific section.

  • Like 1
Posted
5 hours ago, farzigalib said:

There is one attribute for Lenis scroll data-lenis-prevent. Kindly use it in you iframe's container. This might be help you.

Note:- add exact location of the issue for example page or any specific section.

Correclty !

  • 3 weeks later...
Posted

From lenis's github page -


maybe the prop you've been given above will help but this may just be a limitation

image.png

  • 4 months later...
Meraz Meraz
Posted
On 9/8/2024 at 10:40 PM, Mohamed Hassan said:

You can fix this problem with a single line of css

iframe {

pointer-events: none;

}

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...