waypoints icon indicating copy to clipboard operation
waypoints copied to clipboard

Having a section anchor in focus and refreshing page will make my waypoints fail

Open sbR569 opened this issue 7 years ago • 0 comments

Hey! I think that my problem is not a big think, but I don't get the resolution by myself. I've got a function that will add or remove classes from Animate.css by direction of scrolling. If I'm refreshing the page (CTRL+F5) and get the focus on the section where the fade will happen, the offset is completely different and sometimes the fade classes are switched. The problem excist only on the classes "fadeInBottom" and "fadeInTop".

Here is my code:

$(fade).each(function (index, element) {
  $(fade + 'bottom').css('opacity', 0);
  $(element).waypoint({
    handler: function (direction) {
      if (direction === 'up') {
        $(element).removeClass('fadeUp');
        $(element).addClass('fadeOutDown');
      }
      else if (direction === 'down') {
        $(element).removeClass('fadeOutDown');
        $(element).addClass('fadeUp');

      }
      $(element).addClass('fadeInUp');
    }, offset: '65%'
  });
});

Thanks for the help! :)

sbR569 avatar Jun 08 '18 21:06 sbR569