WordPress.org

Ready to get started?Download WordPress

Forums

[closed] [Theme: Twenty Twelve] Change width response from 600px to 760px (2 posts)

  1. gcoulby
    Member
    Posted 1 year ago #

    I am having problems and I don't know why, five minutes ago I had this working then it just stopped. I've reverted and it still doesn't work. Anyway I want to change the width, where the mobile view starts, from 600px to 760px so all browsers less than 760px see the mobile menu. I got it working by downloading this version of navigation.js

    /**
     * navigation.js
     *
     * Handles toggling the navigation menu for small screens.
     */
    
    jQuery( document ).ready( function( $ ) {
    	var masthead = $( '#masthead' ),
    		largeWindow = window.matchMedia( 'screen and (min-width: 600px)' ),
    		timeout = false;
    
    	$.fn.smallMenu = function() {
    		if ( ! masthead.find( '.menu' ).children().length ) {
    			$( '.menu-toggle' ).remove();
    			return;
    		}
    
    		masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' );
    		masthead.find( '.site-navigation h3' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' );
    
    		$( '.menu-toggle' ).off( 'click' ).click( function() {
    			masthead.find( '.menu' ).stop().slideToggle();
    			$( this ).toggleClass( 'toggled-on' );
    		} );
    	};
    
    	// Check viewport width on first load.
    	if ( ! largeWindow.matches )
    		$.fn.smallMenu();
    
    	// Check viewport width when user resizes the browser window.
    	$( window ).resize( function() {
    		if ( false !== timeout )
    			clearTimeout( timeout );
    
    		timeout = setTimeout( function() {
    			if ( ! largeWindow.matches ) {
    				$.fn.smallMenu();
    			} else {
    				masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );
    				masthead.find( '.site-navigation h3' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' );
    				masthead.find( '.menu' ).removeAttr( 'style' );
    			}
    		}, 200 );
    	} );
    } );

    from here http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-content/themes/twentytwelve/js/theme.js.source.html and changed the min-width call in here to 760px and placed this in my css

    @media screen and (min-width: 760px) { !important}		/* === Begin 'Mobile View' <=760px; === */

    my website is http://www.apalis.co.uk

    help would be greatly appreciated, I'm sure I'm missing something small.

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you post this on the thread you started this morning?http://wordpress.org/support/topic/theme-twenty-twelve-responsive-menu-mobile-view-edit?replies=1

Topic Closed

This topic has been closed to new replies.

About this Topic