Jump to content
Search Community

ScrollTo Plugin not working, please help

gabrieal 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

im putting together a banner that has a lot of legal that needs to auto scroll to the end. 

Heres what i have going on - 

 

i have divs nested in my html  that looks like this 

 

            <div id="legal_Box" class="dimensions" >
                    <div id="legal_Box2" class="dimensions">
                    <div id="legal" class="dimensions"></div>
                </div>
            </div>

 

in the css i have set element using overflow-y:scroll; 

 

#legal_box2 {
    overflow:hidden;
    position: absolute;
    width: 284px;
    height: 757px;
    left: 0px;
    background-image: url(imgs/legal.png);
     overflow-y:scroll;
}

 

in my js i want it to just scroll to the max amount.

 

TweenMax.to(legal, 2, {scrollTo:"max"});

 

for some reason it just does nothing. tried trouble shooting it a few ways but no luck. i have the latest CDN.
 <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/plugins/ScrollToPlugin.min.js"></script>

 

Ultimately what i need to have happen is the legal which has the png starts scrolling as soon as the banner loads. scrolls to the end and then goes back to the top.

 

made a pen to help. (added dummy text where the png would be.)

See the Pen yRRqLz by anon (@anon) on CodePen

 

what am i missing? is it the nested divs in my html? 
any help or insight is greatly appreciated. 


thanks

gabe

Link to comment
Share on other sites

YAY!
so just one question so i can understand where i went wrong. 

when you say :

  1. You didn't load ScrollToPlugin

I thought i was loading it here with this code. did i miss something?
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/plugins/ScrollToPlugin.min.js"></script>


 

Thank you! Greensock is king!

Link to comment
Share on other sites

in the codepen i made i thought it was included in the resources already so i did not put it in. maybe that was the error?


but i did included it in my local html file thats why i was confused as to why it was not working for me locally. well it works now.

i think it came down to me not using the correct div id name in my js.

 

geez so strange as i could of sworn i tried all the names associated with that scroller element. must of been tired. 

thanks again!

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