-
AuthorPosts
-
May 20, 2022 at 3:24 pm #1352427
hi there,
on an one-pager i have achors and a main menu (logo top, menu below)
for some reason the anchor jumps to far on tablet.
smartphone and desktop works like it should.
i already diabled all plugins, cleared my child-css completly, but i cant find what i did wrong.
may you can help. login below.
thanx in advanced
May 21, 2022 at 7:49 pm #1352509Hey Ramon,
Thanks for the login, this seemed to be happening around 1024px when your tablet header was sticky, I’m not sure the cause but I added this to your child theme and it seemed to correct:function custom_tablet_scroll_script() { ?> <script> (function($) { $('a[href*=#]:not([href=#])').click(function() { 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) { if ($(window).width() > 990) { $('html,body').animate({ scrollTop: target.offset().top - 195 //offsets for fixed header }, 1000); return false; } else {} } } }); //Executed on page load with URL containing an anchor tag. if($(location.href.split("#")[1])) { var target = $('#'+location.href.split("#")[1]); if (target.length) { if ($(window).width() > 990) { $('html,body').animate({ scrollTop: target.offset().top - 195 //offset height of header here too. }, 1000); return false; } else {} } } }(jQuery)); </script> <?php } add_action('wp_footer', 'custom_tablet_scroll_script');
Please clear your browser cache and check.
Best regards,
MikeMay 23, 2022 at 11:21 am #1352613hey mike,
thanks a lot for the great support. will it be part in one of ther next updates?
greetz
May 23, 2022 at 12:21 pm #1352626Hi,
Glad this helped, it is a customization for you so keep in your child theme, unless there is anything else we can help with on this issue, shall we close this then?Best regards,
MikeMay 23, 2022 at 1:55 pm #1352635thx again and can be closed ^^
greetz
May 23, 2022 at 6:15 pm #1352651Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Anchors on Tablet’ is closed to new replies.