Skip to content

Instantly share code, notes, and snippets.

@zdimaz
Last active February 22, 2018 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdimaz/aa26c4b6f62b9da0ba41b54616e7cd31 to your computer and use it in GitHub Desktop.
Save zdimaz/aa26c4b6f62b9da0ba41b54616e7cd31 to your computer and use it in GitHub Desktop.
Анимация при скроллинге страницы
Анимация при скроллинге страницы
/**
** 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