Tagged: LayerSlider, mobile menu
-
AuthorPosts
-
March 10, 2022 at 1:16 pm #1343991
Dear Kriesi-Team,
on a website I only use a menu and header created within layer slider (default menu is hidden on every page). I want to setup version of for mobile devices wich should contain only a hamburger menu icon.
My question: is there a link to trigger the appearance of the mobile menu? It should react like the regular Burger-Menu-Button which is automatically createt by the theme.
thank you in advance,
WolframMarch 11, 2022 at 3:00 am #1344079Hey Wolfram,
Yes, the mobile menu is just hidden and is using media query to trigger it: https://www.w3schools.com/css/css_rwd_mediaqueries.asp
If the device used to view the site has a width of 767px or less, the mobile menu will be shown (if you resize your browser you’ll see this show up as well)Best regards,
NikkoMarch 11, 2022 at 10:11 am #1344104Good Morning Nikko,
thank you for the quick reply. Maybe I did express this the wrong way.
On every page of this website the menu is hidden because I had to build my own menu within the layerslider. There will be a second Layerslider containing just a (self built) Burgermenu-Button. I need a way to trigger the (enfold)-mobile menu with this button if this is possible at all. If you want to take a look I‘ll provide you with the website-data.
I also put a (temporary) big Burger-Button in the Layerslider…best regards,
WolframMarch 11, 2022 at 2:50 pm #1344144Hi,
Thank you for the link to your site, typically you would add a custom class such as custom-menu-toggle to the element you want to trigger the mobile menu and then add this script to the end of your functions.php file in Appearance ▸ Editor:function custom_script() { ?> <script> (function($){ $(".custom-menu-toggle").on('click', function() { $('.av-hamburger').trigger('click'); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
but I don’t see the header in the source code on your homepage, you will need to enable this to show the burger menu.
The burger menu is created on click from the main menu, so the main menu and header must be on the page for the burger menu to be created.Best regards,
MikeMarch 11, 2022 at 9:13 pm #1344170Hey Mike,
thank you. I will try this solution and get back to you. It could take a little while since I‘m not realy an exprt in php. I deactivated the headers because I thougt i dont need them but luckily this is an easy fix…
Best regards,
WolframMarch 12, 2022 at 12:23 pm #1344195March 18, 2022 at 10:45 pm #1345160Good evening Mike,
the short story: It did not work.
here‘s what I did: I activated the header on the start page, copied your code to the functions.php and created the class you suggested
I also put a link to the element (thougt, there must be a link :/ ) but nothing happens.
So probably I made a mistake somewhere since I know nothing about php. I‘m not sure there is a solution for my specific problem. Maybe you could have another look or I will try to find a different solution.
best regards,
WolframMarch 19, 2022 at 5:02 pm #1345190Hi,
Thanks for your feedback, as I understand your plan from your first post, the burger icon in the layerslider is going to be for your mobile view and doesn’t need to work on desktop, so I changed the link in the layerslider burger icon to #custom-menu-toggle and changed the function to this:function custom_script() { ?> <script> (function($){ $('a[href*="#custom-menu-toggle"]').on('click', function() { $('.av-hamburger').trigger('click'); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
now the layerslider burger icon opens the theme burger menu on click on devices below 990px.
Best regards,
MikeMarch 20, 2022 at 4:20 pm #1345261Hey Mike,
thank you so much. Now it works like it is intendet and I only have to figure out a way to hide the normal menus while they are still there (think the answer is in this thread (https://kriesi.at/support/topic/activate-the-mobile-menu-past-990px/).
But again, thank you + I‘ve learnt a lot :)Best regards,
WolframMarch 20, 2022 at 5:23 pm #1345263Hi,
Glad to hear, to hide the header and mobile menu try this css:.responsive #top #wrap_all #header .av-hamburger { visibility: hidden; } .responsive #top #wrap_all #header { height:0; }
After applying the css, please clear your browser cache and check.
Best regards,
MikeMarch 22, 2022 at 9:07 pm #1345584Good evening Mike,
everything is fine now so thank you again for your help.
… and this also applies for the whole kriesi support team: You‘re incredible!
best regards,
Wolframps.: Ich think you can close this thread now :)
March 23, 2022 at 1:04 am #1345600Hi,
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 ‘open (or link) the mobile menu from button within Layerslider’ is closed to new replies.