Thanks, this seems to work except when the same link is clicked again (but
that's probably not Jquery's fault). Since I am not too familiar with how to
access things using Javascript it was the following row that I couldn't get
right:  
var target = location.hash && $(location.hash)[0];

You talk about improving the Jquery domumentation. My question is then: *is*
there a proper documentation somewhere? The "documentation" link on
http://jquery.com/plugins/project/ScrollTo leads to your blog
(http://flesler.blogspot.com/search/label/jQuery.ScrollTo) which just seems
to be a collection of announcement for new releases. In the Jquery package I
can only see a small readme with a few notes and a well commented source
code file. For people that know Javascript and Jquery well that is proably
enough, but for Jquery newbies like me it would be great to have a page
where one could see some examples (including this scroll-on-page-load
example) together with an explanation of the important parts of the code for
those examples. On http://www.freewebs.com/flesler/jQuery.ScrollTo/ there
are only the examples but one has to look at the source code for the
explanations. They should be visible on the page itself, just like in the
Jquery tutorials.


Hm.. second time I hear that, should I improve the documentation of
jQuery.ScrollTo?
So you need to scroll the page only once, each time it loads?

Try this (I'll use ScrollTo but you can certainly avoid it if you
want)

$(function(){
  var target = location.hash && $(location.hash)[0];
  if( target )
      $.scrollTo( target, { speed:1000,.....} );
});

Ariel Flesler
-- 
View this message in context: 
http://www.nabble.com/Smoothly-scroll-to-the-anchor-given-in-the-URL-tf4936899s27240.html#a14160634
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to