Tagged: fullwidth menu, sticky on mobile
-
AuthorPosts
-
February 13, 2020 at 11:22 am #1184105
Hi
I have tried many solutions form the support forum but none of them worked.
Can you please help me make my site fullwidth submenus sticky on mobile?
I really need a fast solution!
Thank you so much in advance :)
Rasmus
February 13, 2020 at 10:02 pm #1184318Hey rasmusheil,
Here is the code you can put in Enfold > General Styling > Quick Css, if it does not work, put into themes/enfold/css/custom.css
@media only screen and (max-width: 767px) { .responsive #top .av-switch-768.av-submenu-container { top: 170px !important; position: fixed !important; } }
If you need further assistance please let us know.
Best regards,
VictoriaFebruary 19, 2020 at 6:11 pm #1186130Thank you so much Victoria!
It helped me.
February 21, 2020 at 5:54 am #1186604Hi Rasmus,
Great, I’m glad that Victoria could help you out. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardMay 9, 2023 at 5:19 pm #1406918Dear team,
i have the same question / issue. But the quick css code provided earlier does not work on my page.How can I get the submenu sticky on mobile, too?
Thx a lot & best regards Tilman
May 13, 2023 at 7:35 pm #1407285Hi,
This solution is not working for you because your sub-menu is not at the top of your page as in this thread, so you will need some javascript to determine when the menu gets to the top of the page and then make it sticky.
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:function mobile_sub_menu_sticky() { ?> <script> window.addEventListener('DOMContentLoaded', function() { (function($){ var width = $(window).width(); var $stickyTop = $('#sub_menu1'); if (width <= 767) { $stickyTop.waypoint(function(direction) { if (direction === 'down') { $stickyTop.addClass('sticky-top'); } if (direction === 'up') { $stickyTop.removeClass('sticky-top'); } }, { offset: '0%' }); } })(jQuery); }); </script> <?php } add_action('wp_footer', 'mobile_sub_menu_sticky');
Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
Then this CSS in your Enfold Theme Options ▸ General Styling ▸ Quick CSS field:.sticky-top { position:fixed!important; top:0!important; z-index:600!important; }
After applying the css, please clear your browser cache and check.
Best regards,
Mike -
AuthorPosts
- The topic ‘Fullwidth submenu sticky on mobile’ is closed to new replies.