Adding Slide-to-Anchor to Hide effect
Question
In jQuery: I'd like to create an link to on click shows a hidden div (got that working by now) but also slides to it with a smooth-scroll effect. How do I combine the two?
Thanks so much.
OTHER TIPS
It’s a oneliner but can add a really nice effect.
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
<script>
goToByScroll("theIdIWantToGoTo");
</script>
http://djpate.com/2009/10/07/animated-scroll-to-anchorid-function-with-jquery/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow