Created
December 8, 2014 16:47
-
-
Save joshuaogle/44b6ac4fbac387cac821 to your computer and use it in GitHub Desktop.
Animate elements on scroll down
This file contains hidden or 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
| // Needs jQuery and jquery-visible (https://github.com/customd/jquery-visible) | |
| $ -> | |
| if $(".services").length > 0 | |
| animate_services_icon = -> | |
| $(".services-list .image").each (i, el) -> | |
| $el = $(el) | |
| if $el.visible(true, true) | |
| $el.addClass("animated") | |
| animate_services_icon() | |
| $(window).scroll (event) -> animate_services_icon() |
This file contains hidden or 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
| @include keyframes(reveal) { | |
| 0% { | |
| @include transform(translateY(em(30))); | |
| opacity: 0; | |
| } | |
| 100% { | |
| @include transform(translateY(0)); | |
| opacity: 1; | |
| } | |
| } | |
| ... | |
| // On each animated element | |
| &.animated { | |
| @include animation(reveal 1s); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment