2

Recently, I've been working on a WordPress website powered by the Divi theme and builder. Some of the pages have a menu with the URLs set to ID's of certain sections of the page (anchor links) but when clicked, the page refreshes and then scrolls to the relevant section.

What would cause a page to refresh when an anchor link is clicked? I'm baffled!

I've tried changing the URLs (to the below) but still have the same problem. https://www.domain.co.uk/tables/#breakpoint-one https://www.domain.co.uk/tables#breakpoint-one

In static HTML, coding something like this would take a matter of minutes so I cannot understand why the page refresh occurs.

1 Answers1

0

Is the refreshing ocurring only the first time you click on an anchored link? or does it happen every time.

Perhaps you have POST data present (like you arrived on the page after submitting a form). I think the behaviour you describe matches that scenario.

GonZo
  • 58
  • 5
  • It refreshes every time you click on any of the anchored links. The user arrives on the page via the main site navigation, not via a form so there shouldn't be any post data present. I have enabled a lot of caching on this site and a CDN - I'm wondering if that has anything to do with it? –  Jan 06 '21 at 17:02
  • Yes the problem is weird indeed. Perhaps you have some javascript acting on links. – GonZo Jan 06 '21 at 17:30
  • In firefox's code inspector you can see if there are events linked to tags. – GonZo Jan 06 '21 at 17:31
  • How do you check the events? –  Jan 06 '21 at 17:51
  • In Firefox: hover the cursor over a link and right-click, select 'inspect element'. Inspector will open up with the link tag focused. The tag will show a label [event] if there is a javascript event attached to it. – GonZo Jan 06 '21 at 17:58
  • There are three events. Is there any way to disable them from running - one at a time? –  Jan 06 '21 at 18:01
  • For that you need to edit the javascript programs acting on your html. This can be though if you're using a third-party template or plugins. – GonZo Jan 06 '21 at 18:04