-
AuthorPosts
-
March 4, 2026 at 12:07 pm #1495729
Hi,
We’re using a fixed header on mobile. Also with more height because of an integrated widget. The problem is, if you jump to an anchor on mobile, the anchor and the following headline are hidden behind the fixed header.
Is there a way to adapt the anchor links on mobile?
I tried the solution from the thread https://kriesi.at/support/topic/anchor-links-do-not-work-properly-only-on-mobile/ with a js in functions.php. But this results in a JS error:
Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])Regards,
BerndMarch 4, 2026 at 2:45 pm #1495737Hey Bernd,
I added the code in question on a test site, but I’m not seeing any errors after. Are you sure that you copied the whole script?
Best regards,
RikardMarch 4, 2026 at 3:03 pm #1495738Yes, I copied the whole script. I also temporarily disabled caching and JS compression, but the error still occurs.
Regards,
Bernd-
This reply was modified 1 day, 14 hours ago by
Bernd.
March 4, 2026 at 6:26 pm #1495743Hi,
If you provide us with WordPress login details then we can add it for you.
Best regards,
RikardMarch 5, 2026 at 8:46 am #1495763Hi Rikard,
Thanks. The script was copied in functions.php of the child theme, line 84.
Regards,
BerndMarch 5, 2026 at 1:48 pm #1495779Hi,
Thanks for that. I’ve added the code for you, please check your site.
Best regards,
RikardMarch 5, 2026 at 2:04 pm #1495781Hi,
The only difference I see, is, you moved the code from the end to the beginning of the functions.php. The error still occurs:
Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])And on mobile devices using Safari, the anchor with the H2 still disappears under the fixed header.
Regards,
BerndMarch 5, 2026 at 5:53 pm #1495787 -
This reply was modified 1 day, 14 hours ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
