Jump to content
Search Community

Can the 'scrollTo' plugin be used to scroll an iframe? If so, how?

testudo test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello testudo, and welcome to the GreenSock Forum!


I have been trying various ways either through jQuery and native javascript to scroll the iframe. But it seems once the iframe is loaded it is not working, especially in Chrome.
I tried on codepen but the iframe html page i uploaded to codepen assets would be loading from amazon cdn, so that would invoke a cross domain permission denied. If trying to access an iframe from another domain in codepen, it will give you
Error: Permission denied to access property "scrollTop"
Then when i try to run locally on a testing apache server, i dont get the permission denied error, but no scroll happens. Even though i console out the scroll top position. Which outputs the scrollTop position in my console.log().
So i can get the scrollTop position locally on my testing server, but it wont take the set of any value.

After that i tried various other javascript only iframe scrollTo solutions, but it can get the scrollTop value, but it is not working to set a value, even in a loop:



I will keep my eye on this, but either the iframe, even running locally will not set any scrollTo value, even though it gets a scrollTo value of the iframe. I can change various CSS properties through the iframe, and remove/add elements, but I get no scrollTo motion.


Maybe someone else can have better luck. But it looks like this is either a bug or something that changed with iframes. Pretty soon the new HTML5 iframe spec will be available allowing cross domain and better https support.

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