2009
10.07
10.07
Today I had to make a function for a client of mine so I decided to share it with you.
It’s a oneliner but can add a really nice effect to your website.
This function needs jQuery
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
Of course you can change slow to normal or fast or even a int in milliseconds.
And to call it
<script>
goToByScroll("theIdIWantToGoTo");
</script>
Enjoy
This code saved me, I’ll send you a link to the site I’m working on when its finished.
Glad to hear this ! Good luck
ABSOLUTELY BRILLIANT!! I have been looking for this for a long time!! Thank you soooo much!!
always share the code you write for your clients!
thanks! at least i can understand this tutorial
thanks.
I avoid installing “scrollTo” jQuery plugin (which is good but too much for what I needed =)
im so new with this…. where should i put this code? within the head tag?
Works perfect!!!!!!!!!!! Thanx so much!!!!!!!!!