-
AuthorPosts
-
April 6, 2016 at 6:49 am #608700
How can I have the mobile menu options dynamically fill the screen regardless of whether it’s vertical or horizontal? I was playing around with the padding, and while that would be an all right solution for just the vertical or horizontal orientations, I’d prefer not to have to manually adjust several @media screen values.
Is there a way to do this with percentages?
April 8, 2016 at 3:45 am #609967Hi Michae1!
Thank you for using Enfold.
Please add this in the functions.php file:
// menu mobile add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script type="text/javascript"> (function($) { function a() { var mh = $('#mobile-advanced').outerHeight() - 89, mi = $('#mobile-advanced').find('.menu-item'), mc = $(mi).length, nh = mh / mc / 2 - 13; $('#advanced_menu_toggle').bind('click', function() { $(mi).find('a').css({ 'padding-top' : nh, 'padding-bottom' : nh, }); }); $('#advanced_menu_hide').bind('click', function() { $(mi).find('a').removeAttr('style'); }); } setTimeout(a(), 1000); })(jQuery); </script> <?php }
And the following css code in the Quick CSS field:
#mobile-advanced li > a:before, .html_header_mobile_behavior #mobile-advanced span > a:before, #mobile-advanced .mega_menu_title:before { top: 40%; }
Regards,
IsmaelApril 8, 2016 at 5:20 am #609993Thanx Ismael,
Does it need to be in the core theme functions.php? Or can I just use it in my child functions.php? Because I tried the latter, and it didn’t quite work. I say “not quite” because, it looked like the PHP call at the top and bottom either didn’t need to be there or where inverted. So I deleted them to test that, and it actually worked . . . for a second, then it crashed WordPress (doh!). Luckily WPengine has great backup point management :)
Thoughts?
~ Michae1
April 9, 2016 at 12:29 pm #610556Hi!
You can add it in the child theme’s functions.php file. Please post the code of the functions.php file on pastebin.com.
Regards,
IsmaelApril 9, 2016 at 10:39 pm #610681April 10, 2016 at 2:59 pm #610791Hi!
We updated the code above. Please replace the code. Remove browser cache or hard refresh before testing the page.
Regards,
IsmaelApril 11, 2016 at 8:32 pm #611517Hi Ismael!
It’s updated in the pastebin? <- if so, I didn’t realize pastebin was collaborative. > Or is there another link? Could you tell me what was changed? Thanx!
~ Michael
April 12, 2016 at 5:10 am #611621Hey!
This is the updated code: https://kriesi.at/support/topic/mobile-menu-dynamically-fill-screen/#post-609967
Regards,
IsmaelApril 12, 2016 at 9:48 pm #612162Gothcya, didn’t realize you updated your post. Still no luck though. Now the bullets are just misaligned :( Thoughts?
April 14, 2016 at 4:31 am #613411 -
AuthorPosts
- You must be logged in to reply to this topic.