Last active
February 22, 2018 08:09
-
-
Save zdimaz/aa26c4b6f62b9da0ba41b54616e7cd31 to your computer and use it in GitHub Desktop.
Анимация при скроллинге страницы
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
Анимация при скроллинге страницы | |
/** | |
** Handling animation when page has been scrolled | |
**/ | |
animatedContent : function(){ | |
$("[data-animation]").each(function() { | |
var $this = $(this); | |
if($(window).width() > 767) { | |
$this.appear(function() { | |
var delay = ($this.attr("data-animation-delay") ? $this.attr("data-animation-delay") : 1); | |
if(delay > 1) $this.css("animation-delay", delay + "ms"); | |
$this.removeClass('transparent').addClass("visible " + $this.attr("data-animation")); | |
}, {accX: 0, accY: -250}); | |
} | |
else { | |
$this.removeClass("transparent").addClass("visible"); | |
} | |
}); | |
} | |
/==== | |
.visible { | |
opacity: 1; | |
} | |
.transparent { | |
opacity: 0; | |
} | |
====/ | |
<div class="animated transparent" data-animation="fadeInLeft"> | |
</div> | |
<script src="plugins/jquery.appear.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment