Trying to change mobile menu
-
Hey there, I am trying to change how the menu looks on my site, when viewed in mobile, as it is very awkward to use.
I have narrowed down the menu’s code in the header.php to<!--[if gte IE 9]><!--> <script src="<?php echo PARENT_URL; ?>/js/jquery.mobile.customized.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(function(){ jQuery('.sf-menu').mobileMenu({defaultText: <?php echo '"' . apply_filters( 'cherry_text_translate', of_get_option('mobile_menu_label'), 'mobile_menu_label' ) . '"'; ?>}); }); </script> <!--<![endif]--> <script type="text/javascript"> // Init navigation menu jQuery(function(){ // main navigation init jQuery('ul.sf-menu').superfish({ delay: <?php echo (of_get_option('sf_delay')!='') ? of_get_option('sf_delay') : 600; ?>, // the delay in milliseconds that the mouse can remain outside a sub-menu without it closing animation: { opacity: "<?php echo (of_get_option('sf_f_animation')!='') ? of_get_option('sf_f_animation') : 'show'; ?>", height: "<?php echo (of_get_option('sf_sl_animation')!='') ? of_get_option('sf_sl_animation') : 'show'; ?>" }, // used to animate the sub-menu open speed: "<?php echo (of_get_option('sf_speed')!='') ? of_get_option('sf_speed') : 'normal'; ?>", // animation speed autoArrows: <?php echo (of_get_option('sf_arrows')==false) ? 'false' : of_get_option('sf_arrows'); ?>, // generation of arrow mark-up (for submenu) disableHI: true // to disable hoverIntent detection }); //Zoom fix //IPad/IPhone var viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]'), ua = navigator.userAgent, gestureStart = function () { viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6, initial-scale=1.0"; }, scaleFix = function () { if (viewportmeta && /iPhone|iPad/.test(ua) && !/Opera Mini/.test(ua)) { viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; document.addEventListener("gesturestart", gestureStart, false); } }; scaleFix(); }) </script> <!-- stick up menu --> <script type="text/javascript"> jQuery(document).ready(function(){ if(!device.mobile() && !device.tablet()){ jQuery('<?php echo apply_filters( "cherry_stickmenu_selector", ".header .nav__primary" ); ?>').tmStickUp({ correctionSelector: jQuery('#wpadminbar') , listenSelector: jQuery('<?php echo apply_filters( "cherry_stickmenu_listen_selector", ".listenSelector" ); ?>') , active: <?php echo (of_get_option('stickup_menu', 'false')=="false") ? 'false' : 'true'; ?> , pseudo: <?php echo apply_filters( "cherry_stickmenu_option_pseudo", "true" ); ?> }); } }) </script> <a href="https://plus.google.com/112294281972199350039" rel="publisher"><!-- Google+ --></a> </head>Though I have no idea what to change to get the code I want to show to work.
The menu script I want isfunction responsiveMobileMenu() { $('.rmm').each(function() { $(this).children('ul').addClass('rmm-main-list'); // mark main menu list var $style = $(this).attr('data-menu-style'); // get menu style if ( typeof $style == 'undefined' || $style == false ) { $(this).addClass('graphite'); // set graphite style if style is not defined } else { $(this).addClass($style); } /* width of menu list (non-toggled) */ var $width = 0; $(this).find('ul li').each(function() { $width += $(this).outerWidth(); }); // if modern browser if ($.support.leadingWhitespace) { $(this).css('max-width' , $width*1.05+'px'); } // else { $(this).css('width' , $width*1.05+'px'); } }); } function getMobileMenu() { /* build toggled dropdown menu list */ $('.rmm').each(function() { var menutitle = $(this).attr("data-menu-title"); if ( menutitle == "" ) { menutitle = "Menu"; } else if ( menutitle == undefined ) { menutitle = "Menu"; } var $menulist = $(this).children('.rmm-main-list').html(); var $menucontrols ="<div class='rmm-toggled-controls'><div class='rmm-toggled-title'>" + menutitle + "</div><div class='rmm-button'><span> </span><span> </span><span> </span></div></div>"; $(this).prepend("<div class='rmm-toggled rmm-closed'>"+$menucontrols+"<ul>"+$menulist+"</ul></div>"); }); } function adaptMenu() { /* toggle menu on resize */ $('.rmm').each(function() { var $width = $(this).css('max-width'); $width = $width.replace('px', ''); if ( $(this).parent().width() < $width*1.05 ) { $(this).children('.rmm-main-list').hide(0); $(this).children('.rmm-toggled').show(0); } else { $(this).children('.rmm-main-list').show(0); $(this).children('.rmm-toggled').hide(0); } }); } $(function() { responsiveMobileMenu(); getMobileMenu(); adaptMenu(); /* slide down mobile menu on click */ $('.rmm-toggled, .rmm-toggled .rmm-button').click(function(){ if ( $(this).is(".rmm-closed")) { $(this).find('ul').stop().show(300); $(this).removeClass("rmm-closed"); } else { $(this).find('ul').stop().hide(300); $(this).addClass("rmm-closed"); } }); }); /* hide mobile menu on resize */ $(window).resize(function() { adaptMenu(); });This is because of how the menu is structured, the latter is much better, however, I have no experience with changing menus in WP.
All help is appreciated.
Thanks a lot.
-Jordan
-
Hi Jordan
What theme are you using?
I’d recommend contacting the support team or going to the support forum for that specific theme.
Hey,
I contacted the support team (it’s Cherry framework), and they were saying that it would cost an additional fee.
And to be honest, seeing as I gave them all the code that I needed, I don’t really want to fork out $50+, it’s just the question of what the hell their code does, and what I need to changeUnfortunately, these forums don’t support commercial products, so sounds like that’s your best option.
http://codex.wordpress.org/Forum_Welcome#Commercial_Products
And in this case, I don’t think that theme is released under GPL, so that’s an even bigger problem here.
The topic ‘Trying to change mobile menu’ is closed to new replies.