jQuery: Scroll to the Top of a Page CodeUnit 04 NOV 2009

jQuery-logoMy current project requires me to split up a particularly long survey into chunks, allowing a survey taker to only submit those chunks that he/she feels like submitting and ignoring the rest.

Now to be all spiffy I simply fade out the affected chunk once the user clicks submit and then throw back a growl notification at him thanking him for his submission. However, it was at this point that I hit a small snag in that the growl works visually best if you scroll all the way back up to the top of the page and thus I set about looking on the web for a decent scrollTo jQuery plugin as quite simply I don’t have the time to whip up my own.

All of which brought to me the discovery of Ariel Flesler’s nifty jQuery.ScrollTo plugin which you can read more about (and grab) here: http://flesler.blogspot.com/2007/10/jqueryscrollto.html

Add the link to the plugin in your page and hey presto, when you want to scroll the screen all the way up, simply do this:

$.scrollTo(0);

 Nifty.

Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.

  • Very nice article. I thought to let you know that you website wasn’tt getting displayed properly on minimo mobile web browser on my pda.

    Have a nice time…sorry for typing mistake

  • Very nice article. I thought to let you know that you website wasn’tt getting displayed properly on minimo mobile web browser on my pda.

    Have a nice time…sorry for typing mistake