Last active
January 31, 2023 21:28
-
-
Save lucianobragaweb/7471884 to your computer and use it in GitHub Desktop.
Esconder elementos ao rolar a página.
This file contains hidden or 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
// Script jQuery para esconder um elemento na página quando a rolagem ultrapassar 200px | |
$(window).scroll(function(){ | |
if($(document).scrollTop() > 200){// se a rolagem passar de 200px esconde o elemento | |
$('#elementoAEsconder').hide(); | |
} else { // senão ele volta a ser visivel | |
$('#elementoAEsconder').show(); | |
} | |
}); |
This file contains hidden or 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
// O efeito fica melhor usando Fade | |
// Script jQuery para esconder um elemento na página quando a rolagem ultrapassar 200px | |
$(window).scroll(function(){ | |
if($(document).scrollTop() > 200){// se a rolagem passar de 200px esconde o elemento | |
$('#elementoAEsconder').fadeOut(); // Esconde usando fadeOut | |
} else { // senão ele volta a ser visivel | |
$('#elementoAEsconder').fadeIn(); // Mostra usando fadeIn | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obrigado!