Jump to content

Sumanjit SenGupta

Animations not working on reload

Go to solution Solved by Rodrigo,

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

I've started with javascript and GSAP in my project. I've used Tweenlite.to() to change the opacity of some anchor tags.


The animations are working absolutely great the first time I'm opening the page. But if I reload the page, the tweens are not working. I'm closing the tab and opening the page in a new tab and its working again.

Why is it so?



<--HTML file-->



<script src="animations.js"></script>
                                <a href="#" id="a_home" onMouseOver="inHome()" onMouseOut="outHome()">




function inHome(){
TweenLite.to("#a_home",0.3,{css:{opacity: 1}});
function outHome(){
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.


I wasn't able to replicate the behavior you described. My tests show the animation working fine on reload of the page.

I edited the pen only to make the effects more noticeable (added color and more extreme change in opacity)


I tested in Chrome and FireFox




If the problem persists please provide more details on how to replicate it.


Also please note that it is not necessary to wrap the properties inthe css{} object. The shorter code below will work fine:

function inHome(){
  TweenLite.to("#a_home",0.3, {opacity: 1});
function outHome(){
  TweenLite.to("#a_home",1.5, {opacity:0.7});
Link to comment
Share on other sites

  • Solution



This is a very freaky behaviour that sometimes shows it's ugly face. I remember a couple of posts like this, please check the following posts and see if the solutions proposed there solve your issue:







Link to comment
Share on other sites

I just tested

See the Pen IBsit by GreenSock (@GreenSock) on CodePen

and did not see the above described behavior.. the animation worked on every page reload.


Tested on PC - Windows 7 (64-bit) Firefox 31 and Chrome 36 (Version 36.0.1985.143 m)



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.