Jump to content
Search Community

ScrollTrigger and ScrollTo inside iframe in chrome

pro2html test
Moderator Tag

Recommended Posts

I have one page scroll functionality. On scroll page jumps to top from random position. Sorry I'm without codepen right now. Maybe have you quick answer and you met this problem before?

The link https://emelya.studio/storage/frame/

 

I'm scrolling with this code:

function goToSection(panel, anim) {
   gsap.to(window, {
      scrollTo: {y: panel, autoKill: false},
      duration: 2,
      overwrite: "auto",
      onComplete: () => {
         enableScroll();
      }
   });
}

gsap.utils.toArray(".map-slide-trigger").forEach((panel, i) => {
   ScrollTrigger.create({
      trigger: panel,
      onEnter: () => goToSection(panel)
   });

   ScrollTrigger.create({
      trigger: panel,
      start: "bottom bottom",
      onEnterBack: () => goToSection(panel)
   });
});
Link to comment
Share on other sites

  • pro2html changed the title to ScrollTrigger and ScrollTo inside iframe in chrome

Hey pro2html and welcome to the GreenSock forums. 

 

A few notes:

  • Your webpage gives a 404.
  • Please create a minimal demo when seeking debugging help in these forums.
  • The demo where you got this approach from is an exploration as to what is possible. I don't recommend using this sort of approach in production because webpages are not meant to be restricted in this way. If you are going to try and restrict scrolling in this way, I recommend using a more full solution like FullPage.js because it's specialized in this sort of thing. However even then it's not perfect. You can use GSAP along with FullPage.js.

Happy tweening!

  • Like 1
Link to comment
Share on other sites

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...