Skip to content

Instantly share code, notes, and snippets.

@devinsays
Created April 5, 2019 20:29
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 devinsays/4ff7e00a0d4c75a6aae0a15c7501876b to your computer and use it in GitHub Desktop.
Save devinsays/4ff7e00a0d4c75a6aae0a15c7501876b to your computer and use it in GitHub Desktop.
Scroll Reveal init
// Init Scroll Reveal
initScrollReveal: function() {
window.scrollreveal = ScrollReveal();
$('[data-animation]').each( function() {
var settings = {
'origin' : 'bottom',
'distance' : '0',
'duration': 500,
'delay': 0,
'opacity': 0,
'scale': 1,
'reset': false
}
if ( $(this).data('distance') ) {
settings.distance = $(this).data('distance');
}
if ( $(this).data('duration') ) {
settings.duration = $(this).data('duration');
}
if ( $(this).data('delay') ) {
settings.delay = $(this).data('delay');
}
if ( $(this).data('opacity') ) {
settings.scale = $(this).data('opacity');
}
if ( $(this).data('scale') ) {
settings.scale = $(this).data('scale');
}
if ( $(this).data('reveal-class') ) {
var revealClass = $(this).data('reveal-class')
settings.afterReveal = function(element) {
$(element).addClass(revealClass);
}
}
scrollreveal.reveal( $(this), settings );
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment