Here is a function that you can initiate to fade in up elements with class “fade-in” on viewport. const initFadeInAnimation = () => { const fadeElements = document.querySelectorAll(“.fade-in”); fadeElements.forEach((element) => {...
Here is a code to play split text animation on a text with the class “.split-text” whenever it is visible in the viewport. // Play SplitText Animation on Viewport function playAnimation() { var tl = gsap.timeline(), mySplitText = new...
This is just a code snippet. I will add a demo when I get time. gsap.registerPlugin(ScrollTrigger, SplitText); // Register plugin first // Timeline for split text var tl = gsap.timeline(), mySplitText = new SplitText(“.splitText”, { type:...
This is just a code. Will add a demo soon… // Add active class to all element on viewport const toggleActiveOnViewport = () => { let elements = $(“.toggleActiveOnViewport”); elements.each(function() { let element = this; ScrollTrigger.create({...
In Chart.js, if you want to format the tick labels on the axis to add ‘k’ to the numbers that are above 1000, you can achieve this using the callback function in the ticks options of the chart’s configuration. Here’s an example of how you can...
Here is a jQuery code snippet that will replace all your images with the SVG codes and retain all classes that images have, getting added to the SVG class attribute. // Replace image tag with svg const replaceWithSVG = () => { let imgSelector =...
If you want to make the browser go to a particular section with the id within the page or some different page if the id is not found, then you can do it with the following script. I used it in one of my projects and it is working fine. I am also using it with the...
You must be logged in to post a comment.