Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #1352509

    Hey 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,
    Mike

    #1352613

    hey mike,

    thanks a lot for the great support. will it be part in one of ther next updates?

    greetz

    #1352626

    Hi,
    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,
    Mike

    #1352635

    thx again and can be closed ^^

    greetz

    #1352651

    Hi,
    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Anchors on Tablet’ is closed to new replies.