Strange behavior when loading anchor from URL

Strange behavior when loading anchor from URL was created by robbrich

Posted 5 years 1 month ago #51435
Hello
I have this installed on a site, and on the homepage I have created a mini-menu with two links that will scroll to an anchor when clicked. This works as expected, but when I want to link directly to that anchor from a URL on a different page (without using the scrollTo class) it will go to the homepage, display the section I want, but then it will refresh to the top of the page and then scroll to that anchor. When I was testing the functionality on a page that wasn't the homepage this worked, but since moving it to the homepage it has this odd behavior.
Last Edit:5 years 1 month ago by robbrich
Last edit: 5 years 1 month ago by robbrich.

Please Log in or Create an account to join the conversation.

Replied by robbrich on topic Strange behavior when loading anchor from URL

Posted 5 years 1 month ago #51436
I ended up finding the cause of the problem - it was a form that was being pulled in via iFrame and it had this in the loading script: onload="window.parent.scrollTo(0,0)"

I removed that and all is working.

Thanks
Robb
The following user(s) said Thank You: ced1870

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Strange behavior when loading anchor from URL

Posted 5 years 1 month ago #51443
Hi
thank you for posting the solution :)
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Time to create page: 0.669 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 569 guests and no members online