PDA

View Full Version : Anchor Jumping Issue with bookmarkscroll.js



frank_nito
02-25-2012, 03:09 AM
1) Script Title: bookmarkscroll.js

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/bookmarkscroll.htm

3) Describe problem: I have the script implemented correctly. However, when I scroll to something in the middle of the page, it causes an abrupt jump to the top of the browser. This DOES NOT happen when I scroll to the very bottom or very top, only when I scroll to something in the MIDDLE of the website where the scroll bars don't hit the very top or bottom...

Sample here - http://www.that-creativeguy.com/index6.html. Click to scroll to the MIDDLE SECTION and you will see what I am referring to. It is an abrupt jump instead of a smooth transition and stop to that section of the site.

Please help! :)

jscheuer1
02-25-2012, 04:51 AM
It happens at the bottom too, at least in some browsers.

Anyways, strikes me as a bug in the script. When using the yoffset, if it's appreciable (as it is in your case, -100), the jump from it to the actual hash is noticeable. And the way the script is currently written, that's exactly what happens after the smooth scrolling animation has ended, it jumps to the actual hash/named anchor. Use this version instead:

4372

It jumps to the hash/anchor first, then retraces its movement to the prior position so quickly that you can't tell that anything has happened. Then it smoothly scrolls to the yoffset of the named anchor.

The problem arises in the first place by the script trying to preserve the hash in the URL - a good thing. But doing so after the animation as it was made it jump if the yoffset was anything more than 1 or so.

frank_nito
02-25-2012, 05:41 AM
John, that's perfect! Thanks so much!

frank_nito
08-15-2012, 03:26 AM
Hey John, I am back again with another quick question...Why is it that the bookmarkscroll.js, in Chrome (PC and MAC) and Safari (MAC), jumps back to the top and then scrolls down to the designated anchor.

Check out this example...go here again - http://www.that-creativeguy.com/index6.html.

Click the "Middle" link, let it scroll to the middle. Then, click the "bottom" link and you will see that it jumps back to the very top and then scrolls down to the bottom anchor. Can you help me out with this, please? Thanks!

jscheuer1
08-15-2012, 10:36 AM
Use this updated version (right click and 'Save As'):

4588

frank_nito
08-15-2012, 04:30 PM
Thank John!