0

It's surely simple question but i didn't find what i want. I need css animation (which is class) to add to class element when user scroll to it's Y position (be able to see it).

For example i have one class called AnimationClass

Here is my css animation:

.fadeInUp {
  -webkit-animation-name: fadeInUp;
  animation-name: fadeInUp;
}

@-webkit-keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }

  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }

  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

So when user scroll to element Y position add this class to element class. I don't want to use if (scroll <= 500) .

Update: U wrote down that there is a lot of similar question. But i need CLASS element to animate, not ID. I don't know how to write it in javascript.

5
  • 1
    You could have a look at imakewebthings.com/waypoints Commented Jun 9, 2016 at 13:47
  • I'm not good with javascript, that's why i asked this. Commented Jun 9, 2016 at 13:48
  • 1
    Also here more answers stackoverflow.com/q/21561480/2887133 Commented Jun 9, 2016 at 13:52
  • This elemnts is id not class. Commented Jun 9, 2016 at 14:00
  • @pHenomen You can select on a class and not an ID. Your question has been asked before. This answer uses an ID but could easily be switched out for a class. Commented Jun 9, 2016 at 16:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.