Open Navigation onload

Support Area Forums Umami Open Navigation onload

Viewing 4 posts - 1 through 4 (of 4 total)
URL to the page in question: http://www.thecubankitchenandcoffee.com/
  • Author
    Posts
  • #25818
    Alan Wickstrom
    Participant

    I see a previous thread “OPEN NAVIGATION MENU BY DEFAULT” but the solution offered is to basically re-style the menu with a large block of custom CSS. I don’t want to re-style the menu. I just want to activate (add) the “slicknav_open” class, and remove the “slicknav_collapsed” class when the page loads.

    I tried this by sticking a $(document).ready event down in the footer, but it didn’t work. Is there an easy way to do this?

    Thanks!
    Greg

    #25822
    Bill Robbins
    Moderator

    Hey Greg,

    You can do that. There is a callback built into the slicknav script that fires once it’s been assembled. You’ll need to edit the custom-js.php file that’s in the “includes” folder of the theme. Find this spot:

    
    // Slicknav	
    	jQuery('#primary-menu').slicknav({
    		label: '<?php echo of_get_option('mobile_navigation_name','') ?>',
    		prependTo:'#side-menu',
    		allowParentLinks: true
    	});
    

    and replace it with this:

    
    // Slicknav	
    	jQuery('#primary-menu').slicknav({
    		label			: '<?php echo of_get_option('mobile_navigation_name','') ?>',
    		prependTo		:'#side-menu',
    		allowParentLinks: true,
    		init			: function( autoopen ){}
    	});
    	
    	jQuery(function( autoopen ) {
    		jQuery('#primary-menu').slicknav('open');
    	});
    

    Then save your changes. You can read up on the script at https://github.com/ComputerWolf/SlickNav

    Hope that helps out,
    Bill

    #25829
    Alan Wickstrom
    Participant

    Perfect. Thank you, Bill.

    #25830
    Bill Robbins
    Moderator

    Anytime. Have a good night and let me know if you need anything else.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Open Navigation onload’ is closed to new replies.