Last active
February 12, 2016 13:06
-
-
Save gregogalante/21196b4aa786f50a5c9c to your computer and use it in GitHub Desktop.
Effetto di comparsa elementi durante lo scrolling. Funzione dipendente dal plugin jquery-visible (https://github.com/customd/jquery-visible).
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
// 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