Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #617980

    I’ve made the mobile header fixed so that the menu is accessible at all times. This works fine – however, when you tap to activate the menu, the current page behind the menu instantly scrolls back to the top.

    How can I stop this happening?

    Thanks!

    • This topic was modified 8 years, 8 months ago by jomtones.
    #619415

    OK so I’ve been looking into this – it seems that its the href=”#” that’s causing it in the mobile menu. If I could replace the ‘#’ with javascript:null it might stop the behaviour – *but*, when I add the helper-main-menu.php to ‘shortcodes’ it screws up the header completely, even without any edits.

    Any ideas?

    Thanks

    #620095

    Guys – I’m stumped.

    Please help! I need to remove the ‘#’ from the ‘a href’ in the mobile menu.

    #620096

    Guys – I’m stumped.

    Please help! I need to remove the ‘#’ from the ‘a href’ in the mobile menu, as referenced here:
    http://stackoverflow.com/questions/20215248/prevent-href-link-from-changing-the-url-hash

    #620215

    Hey!

    Please try this code in functions.php to remove the # from mobile menu

    function removeScrollToTop(){
    ?>
    <script>
         jQuery(document).scroll(function() {     
            jQuery("#advanced_menu_toggle").removeAttr("href");     
            jQuery("#advanced_menu_hide").removeAttr("href");        
        });
    </script>
    <?php
    }
    add_action('wp_head', 'removeScrollToTop');

    Regards,
    Vinay

    #627562

    Hi Vinnie – thanks for this!

    Unfortunately, it seems I was wrong about the behaviour – removing the # tag from the button didn’t fix the issue. To be honest, I was so disheartened I gave up on the issue for a couple of weeks!

    So my site is now up at btribble.com – if you have any ideas how to fix the mobile menu so it doesn’t ‘pop’ to the top of the page on tap, I’d much appreciate your help.

    #627815

    Hey!

    That is intended behaviour as mobile menu appears at the top of the page, clicking the button would scroll to the top.

    Regards,
    Yigit

    #627869

    Thanks Yigit – that’s understood, but I’m not trying anything out of the ordinary. I see many mobile sites keep a persistent menu icon on screen at all times – none of them pop to the top on tap. Is there any way I can stop this link from scrolling to the top?

    If you have a moment, please check out the site at http://btribble.com to see what I mean.

    Many thanks

    • This reply was modified 8 years, 7 months ago by jomtones.
    #629162

    Hi,

    To prevent the page from jumping to the top when you click on the mobile icon please follow the instructions in this post provided by Ismael https://kriesi.at/support/topic/advanced-menu-toggle-on-desktop-seems-to-be-an-anchor-tag/#post-626159

    Best regards,
    Vinay

    #636444

    Thanks Vinay. I’ve followed the instructions here but it doesn’t work as yet. I’m using a child theme, so I made the js/ folder and added my edited avia.js here. However, the behaviour is the same. I’ve noticed that two avia.js’ are getting loaded:

    View post on imgur.com

    Could there be something wrong in my functions.php to make this happen? No idea how this works.

    #637263

    Hi,

    Unfortunately, you can’t do this modification in a child theme, actually, there is a way but it’s really not “update-proof”. Is this working when you edit the actual avia.js file in the parent theme folder? The NOT “update-proof” avia.js: https://kriesi.at/support/topic/js-child-theme-problem/#post-633526

    Best regards,
    Ismael

    #771581

    Never did get this fixed in the end – it’s not a major issue, but I imagine it might be a bit annoying for mobile users. Any way to fix this in the current theme?

    Thanks

    http://btribble.com/

    #773098

    Hi jomtones,

    You can comment out the code like this

    //win.scrollTop(0);

    in avia.js (the thread you’ve seen before) and press cmd+r for Mac or ctrl+f5 on Windows and see what happens.

    And like Ismael said before, it has to be done in parent theme and is not “update-proof” unfortunately.

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.