Share Posted August 13, 2019 I'm having trouble getting my animations to work. I've setup very basic animations to get started with, and nothing happens when I load them. Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 Have you tried to create said animations in CodePen? Having us see a simplified example with markup and CSS will help us help you. 3 Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 Hey alostdeveloper and welcome to the forums. This is likely due to a loading issue of your assets but without seeing a live page it's very hard for us to help you figure out what's going wrong. Have you tried looking at your browser's console? Usually it will tell you if something is not loading or if you have a different error with your code. 2 Link to comment Share on other sites More sharing options...
Author Share Posted August 13, 2019 See the Pen OJLMxVW by iamthattgirl (@iamthattgirl) on CodePen It works on codepen, but I can't get it to load in a browser window. Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 Yup, perfectly functional in CodePen (by the way, use the Settings in CodePen to inject <head> stuff) See the Pen dybGVGy by sgorneau (@sgorneau) on CodePen Try loading only TweenMax (remove the <script> calling in TimelineMax.min.js) 2 Link to comment Share on other sites More sharing options...
Author Share Posted August 13, 2019 I normally wouldn't load it like that, but this is a work project. So I need to figure out why it's not working outside of Codepen. Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 Can you please host a live webpage that we are able to see that can reproduce your issue? Otherwise I'm afraid we can't really be of much more help. Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 I think moving the scripts to the bottom of the page will solve this for you. 4 Link to comment Share on other sites More sharing options...
Share Posted August 13, 2019 As pointed out by PointC, the issue is that the script is trying to run before the DOM content that it's looking for is loaded. If you need to keep the script in the head and can't move it to the bottom of the body, you should use the following instead: document.addEventListener("DOMContentLoaded", function(event) { // Your timeline code }); 3 Link to comment Share on other sites More sharing options...
Author Share Posted August 13, 2019 PointC's suggestion worked. Thank you everyone! 1 Link to comment Share on other sites More sharing options...
Author Share Posted August 14, 2019 Any ideas why the animation would be working in IE and Safari, but not Chrome? Link to comment Share on other sites More sharing options...
Share Posted August 14, 2019 3 hours ago, alostdeveloper said: Any ideas why the animation would be working in IE and Safari, but not Chrome? It was working in Chrome when I moved the script on the live page that you had shared previously. So no, no ideas why that may be the case. Maybe you can share a live version of the page again so we can look? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now