Created
April 5, 2019 20:29
-
-
Save devinsays/4ff7e00a0d4c75a6aae0a15c7501876b to your computer and use it in GitHub Desktop.
Scroll Reveal init
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
// 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