jQuery tip…Back to Top

Ever have to do a page that has a lot of back to top links? Say, a staff page with a lot of bios and photos, and after each one you have a link that says Back to top. Well, this made my life much easier.

$('#top').click(function() {
    $(document).scrollTop(0);
});

The 0 could obviously be any value you need it to be, but this little bit of jQuery can come in handy.

Tags: ,

2 Responses to “jQuery tip…Back to Top”

  1. I’m going to be going through all of these tutorials once I watch those vids you linked me so I can apply them to my site. JavaScript seems so freaking exciting, I can’t wait.

  2. jcDesigns says:

    There are a bunch of different libraries out there for javascript. We use Ext at my workplace, but on my freelance stuff and my personal sites (such as this blog), I use jQuery. They all have their own little syntax changes to them, too, but I think once you get one down, you can learn the others pretty easily. Those video tutorials though are just plain awesome.

Leave a Reply