Changes
- The defaults have been made public for modification.
- The anchor filter has been optimized
- A bug was fixed, clicking an anchor with href=# and then a special link, wasn't scrolling.
- A trigger event can be specified, if click is not the desired one.
- If 'cancel' is set to false, the default behaviour of the anchor will occur.
New option 'lazy'
jQuery.LocalScroll counts with a new, and very useful option. If
lazy is set to true, then the plugin will react to new links, that are appended
to the originally matched elements.
jQuery.ScrollTo had some
minor releases and is now at
1.2.4. This is not the version included in this release of jQuery.LocalScroll, but they are perfectly compatible.
Update:jQuery.LocalScroll 1.1.3 was released, the upgrade is recommended, upgrading to jQuery.ScrollTo 1.3 is also adviced (included in the last release).
Links
Downloads
I really advice using the minified versions. The code is optimized for those releases. Source versions should only be used to learn.
6 comments:
Hey Ariel. Much praise for the plugin, it's exactly what I've been looking for. I do have a question though: the Learning JQuery blog mentioned that you should be able to get the anchor link visible in the address line aswell, but saw no mention of this anywhere here nor in the documentation. How do I accomplish this?
Also, is there a way to get the #content go back to the starting position when the page is reloaded? Now it stays on the last clicked link and while the anchor isn't visible in the address line, it is a bit confusing in my case.
Thanks again!
@hannu
That is possible, there's an option 'cancel', when set to false, the hash should appear on the address bar.
I haven't fully tested that option, i was having doubts on whether it would 'jump' or not.
Try it and tell me what's your impression.
As for re-scrolling the page, just add $.scrollTo( 0, {speed:...} ); inside the document ready handler, and it will scroll.
I'd try wrapping it in a setTimeout with 0 delay, I think that could work a bit better.
Let me know how it goes :).
Hi Ariel,
Thanks for a great script. Im a bit of a novice at Jquery, I should be able to get this working but am having difficulties.
Can I send you a page to have a look at?
Thanks
Ian.
Sure Ian, send me the link and I'll check it. If you haven't yet, I advice you to get localScroll 1.1.3 with scrollTo 1.3.
Cheers.
Is it possible to add more than one scrolling container on a single page?
I need to associate forth and back links in each container to work only on that container they are in.
Thanks, great plugin!
Hi maco, you can certainly call the plugin many times, to add different links (with different settings if you want). Each call could scroll different containers (different attribute 'target').
Could you make a demo or give me some more details ?
Cheers.
Post a Comment To get help prepare a demo.