How to animate this when scrolled [closed]

If you go to the following site:

You will notice that the animations occur on Scroll, whereas for me, when I downloaded this it doesn't. What do I do to make my animations occur on scroll?



Copied right from the site you linked to:

If you want to use pre-made animations from that site, you first need to add that code to your project. You can either download it from the website you linked to or you can just point to it.

The first one would be done adding

<link rel="stylesheet" href="css/animations.css">

to the of your HTML document and changing the href attribute for where you actually store it on your website.

The second one will be instead of using local path, you would point to the original website with the code and so your href attribute would look like this:

<link rel="stylesheet" href="">

Then you will need to Add jQuery to the <head> element of your webpage:

<script src=""></script>

Add this before the </body> tag to trigger the animation when the user scrolls to the element:

    $(window).scroll(function() {
        var imagePos = $(this).offset().top;

        var topOfWindow = $(window).scrollTop();
            if (imagePos < topOfWindow+400) {

Replace #animatedElement with the ID or class of the element you want animated. Replace slideUp with an animation class.

400 represents the space between the element and the top of the screen. The animation activates when the element is 400px from the top of the screen. Increase this number to make the animaton activate sooner.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.