Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Effetto di comparsa elementi durante lo scrolling. Funzione dipendente dal plugin jquery-visible (https://github.com/customd/jquery-visible).
// Funzione da richiamare nel document.ready
var scrollEffectsInit = function() {
if($(window).width() > 1024) {
$('.animate').css('opacity', '0');
$('.animate-left').css('left', '-100px');
$('.animate-right').css('right', '-100px');
$('.animate-top').css('top', '-100px');
$('.animate-bottom').css('bottom', '-100px');
}
}
// Funzione da richiamare nel window.scroll
var scrollEffectsExec = function() {
if($(window).width() > 1024) {
$('.animate').each(function() {
if($(this).visible(true)) {
$(this).css('opacity', '1');
if($(this).hasClass('animate-left')) {
$(this).css('left', '0');
} else if($(this).hasClass('animate-right')) {
$(this).css('right', '0');
} else if($(this).hasClass('animate-top')) {
$(this).css('top', '0');
} else if($(this).hasClass('animate-bottom')) {
$(this).css('bottom', '0');
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.