-
AuthorPosts
-
April 20, 2016 at 5:31 am #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.
April 21, 2016 at 10:19 pm #619415OK 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
April 22, 2016 at 5:31 pm #620095Guys – I’m stumped.
Please help! I need to remove the ‘#’ from the ‘a href’ in the mobile menu.
April 22, 2016 at 5:32 pm #620096Guys – 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-hashApril 22, 2016 at 9:11 pm #620215Hey!
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,
VinayMay 5, 2016 at 12:26 am #627562Hi 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.
May 5, 2016 at 1:42 pm #627815Hey!
That is intended behaviour as mobile menu appears at the top of the page, clicking the button would scroll to the top.
Regards,
YigitMay 5, 2016 at 3:41 pm #627869Thanks 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.
May 9, 2016 at 12:59 pm #629162Hi,
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,
VinayMay 22, 2016 at 10:10 pm #636444Thanks 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:
Could there be something wrong in my functions.php to make this happen? No idea how this works.
May 24, 2016 at 6:06 am #637263Hi,
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,
IsmaelApril 4, 2017 at 8:48 am #771581Never 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
April 6, 2017 at 11:13 am #773098Hi 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 -
AuthorPosts
- You must be logged in to reply to this topic.