Last active
January 15, 2024 17:55
-
-
Save kurt-chainlink/b5c700964f290f826d0e3275b5c179f0 to your computer and use it in GitHub Desktop.
Adding GSAP to the Divi Theme (full explanation here https://chainlinkmarketing.com/how-to-add-gsap-to-the-divi-theme-in-wordpress/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wait until DOM is ready | |
document.addEventListener("DOMContentLoaded", function (event) { | |
// wait until images, links, fonts, stylesheets, and js is loaded | |
window.addEventListener("load", function (e) { | |
//only run code on frontend of site (not when logged in making edits) | |
if (document.body.classList.contains('wp-admin')) { | |
} else { | |
//register GSAP plugins | |
gsap.registerPlugin(ScrollTrigger, ScrollToPlugin); | |
// custom GSAP code goes here | |
//small example of GSAP | |
gsap.from('#example-1',{autoAlpha:0}); | |
gsap.set('.example-2',{scale:1.2}); | |
//end of custom GSAP for site | |
} | |
// end of checking logged in | |
}, false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Full article written on the Chainlink Marketing's website found here: "How to Add GSAP to the Divi Theme in WordPress" including: