@Maccer
Indeed, the actual documentation is in the header of the source-code
file. I didn't want to bore people (that won't download it) with
documentation in the project page, or in the blog. The info that
appears in those 2 places is sort of a quick summary of what is the
plugin capable of.
I assumed that, if someone needs documentation, that person had to
download the plugin first.

I think, that if you need some general (javascript/jquery)
documentation, you should first check http://docs.jquery.com/ or some
javascript tutorial, http://www.w3schools.com/js/.

The piece of code I wrote, will scroll each time the page loads, so
when you click a link, it won't scroll. But once it refreshes, it will
look for the element.

Now that I read your first post again, I think you meant it should
scroll to the clicked link, not to the element targeted by that link.
That is a different behavior from what LocalScroll or the piece of
code I wrote, do.

If you want to scroll to the clicked link, then do this:

$(function(){
  var target = location.hash && $('a[hash='+location.hash+']')[0];//
look for the link
  if( target ) //if found
      $.scrollTo( target, { speed:1000 });//scroll to it
});


Ariel Flesler

PS: I'll try to add more examples in the source code for the next
release (very soon).

On Dec 4, 7:06 pm, Maccer <[EMAIL PROTECTED]> wrote:
> 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 
> onhttp://jquery.com/plugins/project/ScrollToleads 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. Onhttp://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-...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to