Just for our visual sake, and to see if we can offer any help with this, can you provide us with a couple links for this so we can see what you’re seeing?
Thread Starter
Chris
(@renaissancedesign)
I’m afraid I’ve already removed the plugin, it was causing issues on a live site.
Easy enough to reproduce though, create two pages, each with #hash1, #hash2 and #hash3 and populate a menu with absolute URLs to them. The problem is on lines 30-39 of assets/js/hash-link-scroll-offset.js – a link on /page1 to /page2#hash1 will scroll to /page1#hash1 if #hash1 exists on /page1.
Should be able to fix it by comparing this.pathname with location.pathname before calling app.scrollToHash.
-
This reply was modified 7 years, 8 months ago by
Chris. Reason: Clarity
Understandable with the need to remove if it was causing issues with things. I’d prefer we aren’t the cause of headaches longer than necessary 😀
Regarding the original issue at hand, thanks for the bits above to use to recreate. At the same time, it’s a question of do we want to offer it across pages, or is it simply meant to be all within the current page.
Nonetheless, thanks for the feedback and conversation.
Thread Starter
Chris
(@renaissancedesign)
If you do decide to fix it this should do the trick on line 34:
if ( ! $( app.hash ) )
change to:
if ( ! $( app.hash ) || location.pathname.replace(/^\//,'') != this.pathname.replace(/^\//,'') )
For anyone wanting to keep an eye on this, or if you want to implement yourself.
https://github.com/WebDevStudios/Hash-Link-Scroll-Offset/issues/18