Skip to content

Instantly share code, notes, and snippets.

@mikhy888
Created January 29, 2019 11:57
Show Gist options
  • Save mikhy888/a7129688f874c22e3aab90fb32c4e958 to your computer and use it in GitHub Desktop.
Save mikhy888/a7129688f874c22e3aab90fb32c4e958 to your computer and use it in GitHub Desktop.
Single side scroll reveal animation
//scroll direction and anim
var scrollDirection = function (elem) {
$(window).on('DOMMouseScroll mousewheel', function (event) {
if (event.originalEvent.detail > 0 || event.originalEvent.wheelDelta < 0) {
if (elem.parent().isOnScreen()) {
console.log("malar");
elem.each(function () {
var $this = $(this);
var delay = $this.attr("data-delay");
setTimeout(function () {
$this.addClass("show");
}, delay);
});
}
} else {
if (elem.isOnScreen() == false) {
elem.removeClass("show");
}
}
});
}($('.single-anim-inner'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment