Ticket #21440: 21440.matchMedia.patch
File 21440.matchMedia.patch, 1.1 KB (added by , 12 years ago) |
---|
-
wp-content/themes/twentytwelve/js/theme.js
6 6 7 7 jQuery( document ).ready( function( $ ) { 8 8 var masthead = $( '#masthead' ), 9 largeWindow = window.matchMedia( 'screen and (min-width: 600px)' ),9 largeWindow = ( ! window.matchMedia ) || window.matchMedia( 'screen and (min-width: 600px)' ).matches, 10 10 timeout = false; 11 11 12 12 $.fn.smallMenu = function() { … … 20 20 }; 21 21 22 22 // Check viewport width on first load. 23 if ( ! largeWindow .matches)23 if ( ! largeWindow ) 24 24 $.fn.smallMenu(); 25 25 26 26 // Check viewport width when user resizes the browser window. … … 29 29 clearTimeout( timeout ); 30 30 31 31 timeout = setTimeout( function() { 32 if ( ! largeWindow .matches) {32 if ( ! largeWindow ) { 33 33 $.fn.smallMenu(); 34 34 } else { 35 35 masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' );