Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Multiple divs with same CLASS (jQuery Waypoints)

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #207780
    Max
    Participant

    I have followed this tutorial: http://spin.atomicobject.com/2015/05/31/scroll-anmiation-css-waypoints/ successfully. I would like to apply the fadein on almost every element on the page. This means using this jQuery method that I would ned to create separate Classes for each element and duplicate the code, because otherwise every element with the same class currently fades in with the first Waypoint only.

    Here is what I had:
    <script>
    // hide our element on page load
    $(‘.fade-in’).css(‘opacity’, 0);

    $(‘.fade-in’).waypoint(function() {
    $(‘.fade-in’).addClass(‘fadeInUp’);
    }, { offset: ‘95%’ });
    By following this page, I tried to adapt it to have:
    </script>

    But I couldn’t get it to work…any ideas please? (My Jquery could well be a bit off)

    <script>
    // hide our element on page load
    $(‘.fade-in’).css(‘opacity’, 0);

    var sticky = [];
    $(‘.fade-in’).each(function(idx){
    sticky[idx] = new Waypoint.Sticky({ element: this });
    $({element: this}).addClass(‘fadeInUp’);
    });
    </script>

    I’m also not sure how to add in the offset part.

    Very many thanks

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.