Last active
May 30, 2019 08:51
-
-
Save oterox/cacbb81631082a4907ddff15c6768543 to your computer and use it in GitHub Desktop.
Scroll anchor jquery
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
$(window).load(function(){ | |
// Quitamos el # del hash | |
var hash = location.hash.replace('#',''); | |
//Si hay un hash es que vamos a mostrar un tipo de pista | |
if(hash != ''){ | |
//Hacemos scroll al id que viene en el hash y le quitamos 50px para que aparezca debajo del menú | |
$('html, body').animate({ scrollTop: $('#' + hash).offset().top - 50}, 1000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment