Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lordgammon opened this issue Jun 8, 2018 · 0 comments

Comments

@lordgammon
Copy link

lordgammon commented Jun 8, 2018

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! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant