A new major update of jQuery.LocalScroll has seen the light.
Two minor releases were added after it and is now at 1.2.2. I'll detail them all together:
- Replaced a $('[name='+name+']') for a document.getElementsByName(name) to critically improve perfomance.
- Small improvements to make the code shorter.
- The last argument received by onBefore when scrolling the window, is no more $(window) but the real element being scrolled.
- Renamed the option 'persistent' to 'lazy', the latter seemed more adequate. Using 'persistent' will still work (backwards compatibilty)
- Added the option 'stop', if true (default), each event will stop any previous animations of the target.
- Added the option 'lock', if true, the plugin will ignore events if already animating.
- Added $.localScroll.hash( settings ); which will scroll to the given element if the URL contains a valid hash.
- Removed the option 'cancel' that wasn't working well, and added the option 'hash'. It does what 'cancel' was meant to do, but in a different way.
After a scroll, the hash( #some_id ) of the link is added to the URL.
Note:This setting is not compatible with options like offset and margin, as the browser will natively scroll in the end.
If you use the option 'target'(to scroll an overflowed element) and the window has overflow, setting the hash will scroll the window as well. So my advice is:
only use 'hash' when scrolling the window.
jQuery.LocalScroll 1.2.x requires jQuery.ScrollTo 1.3.1 or higher.
- Main post
- Github Repo
- Regular Demo
- AJAX Demo
- jQuery.ScrollTo's demo (must see)