• howdy
    The menu still does not work properly on tablets.
    If I tap on a submenu (that has items) it not show me that items but load the subitem I tapped .
    Also I can not select the main (parent) item (that is a link),
    should do something, believe in javascript, that when I tap once I show the submenu and if tap again shows me that page.
    I hope I was clear

Viewing 4 replies - 1 through 4 (of 4 total)
  • May take a few days but I am refreshing the Navbar Guide for Czr 3.2 and will try to cover this.

    Thread Starter pirro70

    (@pirro70)

    ok I’ll wait for it
    thanks

    Thread Starter pirro70

    (@pirro70)

    maybe I found a solution
    I worked on a jquery snippet found on web

    add_action('wp_head', 'mobile_menu');
    function mobile_menu() {
    if(wp_is_mobile()) :?>
                     <script>
    
    function isTouchDevice(){
        return typeof window.ontouchstart !== 'undefined';
    }
    
    jQuery(document).ready(function($){
    jQuery("li.menu-item-has-children  > a").removeAttr("data-target").removeAttr("data-toggle").removeClass("clicked");
    
        if(isTouchDevice()) {
            jQuery("li.menu-item-has-children  > a").click(function(event) {
    			if(jQuery( document ).width() > 979)
    			{
    				jQuery("li.menu-item-has-children > a").not(this).removeClass("clicked");
    				jQuery("li.menu-item-has-children > a").parents().removeClass("open");
    
    				jQuery(this).toggleClass("clicked");
    				if (jQuery(this).hasClass("clicked"))
    				     {
    					   event.preventDefault();
    					    jQuery(this).parents().addClass("open");
    					 }
    			} 
    
            });
    		jQuery("#main-wrapper").click(function(event) {
    			jQuery("li.menu-item-has-children > a").parents().removeClass("open");
    			jQuery("li.menu-item-has-children > a").removeClass("clicked");
    		 });
        }
    });
    
    </script>
    
    <?php 
    
    endif;
    }

    I tried on IPad and it work fine.
    could someone more experienced than me see if there’s something wrong or if the code can be written better?

    Thread Starter pirro70

    (@pirro70)

    And if someone could try on an Android tablet

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Menu on tablet’ is closed to new replies.