- This topic has 8 replies, 3 voices, and was last updated 2 years, 11 months ago by
David.
-
AuthorPosts
-
April 5, 2023 at 12:47 am #2597496
Torsten
Hi,
how can I adjust the anchor so that e.a. menu point “Referenzen” is reached a few pixel up, for the moment I have a white space above the “Referenzen”-section and the header on all display sizes…
thx ahead,
Torsten.April 5, 2023 at 1:17 am #2597546Fernando Customer Support
Hi Torsten,
Try setting the Anchor id to this text instead “Designberatung” which is right below “Referenzen”.
April 5, 2023 at 8:56 am #2598275Torsten
Hi Fernando,
all anchors are “misplaced” by about the same amount. And as I’m using different widgets and display options (toggle visibility) for desktop, tablet and/or mobile I had an issue with the slide-out menu not working except for desktop previously.
Therefore I need a code to set an offset for all anchors the same amount.
best,
TorstenApril 5, 2023 at 6:00 pm #2598791Fernando Customer Support
Can you try adding this through a Hook Element:
<script> jQuery(function($) { $('li.smooth-scroll > a[href*="#"]:not([href="#"]), a.smooth[href*="#"]:not([href="#"])').on( 'click', function(e) { e.preventDefault(); if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top + 100 }, 500); } } }); }); </script>Hook it to
wp_footer.April 6, 2023 at 1:10 am #2599075Torsten
Hi Fernando,
I added the code, see screenshot-link in private information.
No changes, I tried as well changing the values…
best,
TorstenApril 6, 2023 at 4:28 am #2599304Torsten
Hi,
I added a screenshot in private information with 6 Menu items (I wrote each menu item beside the burger menu in red) and marked the offset in each with 2 red lines, like this it is obvious that it’s the same offset for each widget / section.
best,
TorstenApril 6, 2023 at 7:03 am #2599493David
StaffCustomer SupportHi there,
that looks real tricky, the only way i would think you could make that work consistently is if the page was split into sections and each section had the anchor attached to it.
you would also need to make sure the site header was a constant height.
That way you have consistency for the anchor positioning.
April 6, 2023 at 9:39 am #2599849Torsten
was worth the try.
Thx for the effort,
best,
TorstenApril 7, 2023 at 3:34 am #2600706David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.