Created
February 8, 2018 08:18
-
-
Save Roshanb54/08919e47a104afaf3ad990d89fd88277 to your computer and use it in GitHub Desktop.
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
var jump=function(e) | |
{ | |
if (e){ | |
e.preventDefault(); | |
var target = jQuery(this).attr("href"); | |
}else{ | |
var target = location.hash; | |
} | |
jQuery('html,body').animate( | |
{ | |
scrollTop: jQuery(target).offset().top | |
},500,function() | |
{ | |
location.hash = target; | |
}); | |
} | |
jQuery('a[href^=#]').bind("click", jump); | |
if (location.hash){ | |
setTimeout(function(){ | |
jQuery('html, body').scrollTop(0).show(); | |
jump(); | |
}, 1000); | |
}else{ | |
jQuery('html, body').show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment