Created
June 18, 2020 14:59
-
-
Save dougkeeling/dd1f0925675c2869197b775669ab2d28 to your computer and use it in GitHub Desktop.
[ScrollMagic loop over elements] Loop through elements with a given class and add animations to them. Be sure each item in the loop has a unique ID. #scrollmagic #javascript #jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.my-class').each(function(){ | |
var id = $(this).attr('id'); | |
scenes[scenes.length] = new ScrollMagic.Scene({triggerElement: '#'+id, duration: 0, triggerHook: 0.9, reverse: false}) | |
.setClassToggle('#'+id, "animate"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment