Posts tagged effect

Animated scroll to anchor/id function with jQuery

82

Update : Post update here

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 requires 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

Share

Related Posts:

A simple div slide down JS script

29

Hello all,

I always wonder why people get there website loaded with 70kbs JS libs for only a couple of Effects !

So here is my script to slide down a div made only of a few lines of Javascript.

If you are looking for a tutorial on how to use jQuery sliding function click here

(more…)

Share

Related Posts:

Go to Top