Ticket #26031: 26031.diff
File 26031.diff, 2.9 KB (added by , 12 years ago) |
---|
-
src/wp-content/themes/twentyfourteen/js/functions.js
1 ( 2 var body 3 1 (function( $ ) { 2 var body = $( 'body' ), 3 _window = $( window ); 4 4 5 5 // Enable menu toggle for small screens. 6 ( 6 (function() { 7 7 var nav = $( '#primary-navigation' ), button, menu; 8 8 if ( ! nav ) { 9 9 return; … … 23 23 24 24 $( '.menu-toggle' ).on( 'click.twentyfourteen', function() { 25 25 nav.toggleClass( 'toggled-on' ); 26 } 27 } 26 }); 27 })(); 28 28 29 29 /* 30 30 * Makes "skip to content" link work correctly in IE9 and Chrome for better … … 42 42 43 43 element.focus(); 44 44 } 45 } 45 }); 46 46 47 47 $( function() { 48 48 // Search toggle. 49 49 $( '.search-toggle' ).on( 'click.twentyfourteen', function() { 50 var that 51 50 var that = $( this ), 51 wrapper = $( '.search-box-wrapper' ); 52 52 53 53 that.toggleClass( 'active' ); 54 54 wrapper.toggleClass( 'hide' ); … … 56 56 if ( that.is( '.active' ) ) { 57 57 wrapper.find( '.search-field' ).focus(); 58 58 } 59 } 59 }); 60 60 61 61 /* 62 62 * Fixed header for large screen. … … 65 65 * The callback on the scroll event is only added if there is a header 66 66 * image and we are not on mobile. 67 67 */ 68 68 if ( _window.width() > 781 ) { 69 69 var mastheadHeight = $( '#masthead' ).height(), 70 70 toolbarOffset, mastheadOffset; 71 71 … … 83 83 } else { 84 84 body.removeClass( 'masthead-fixed' ); 85 85 } 86 } 86 }); 87 87 } 88 88 } 89 89 90 90 // Focus styles for menus. 91 91 $( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() { 92 92 $( this ).parents().toggleClass( 'focus' ); 93 } 93 }); 94 94 } ); 95 95 96 96 // Arrange footer widgets vertically. 97 97 if ( $.isFunction( $.fn.masonry ) ) { 98 $( '#footer-sidebar' ).masonry( 98 $( '#footer-sidebar' ).masonry({ 99 99 itemSelector: '.widget', 100 columnWidth: function( containerWidth ) {100 columnWidth: function( containerWidth ) { 101 101 return containerWidth / 4; 102 102 }, 103 gutterWidth: 0,104 isResizable: true,105 isRTL: $( 'body' ).is( '.rtl' )106 } 103 gutterWidth: 0, 104 isResizable: true, 105 isRTL: $( 'body' ).is( '.rtl' ) 106 }); 107 107 } 108 108 109 109 // Initialize Featured Content slider. 110 _window.load( 110 _window.load(function() { 111 111 if ( body.is( '.slider' ) ) { 112 $( '.featured-content' ).featuredslider( 113 selector: '.featured-content-inner > article',112 $( '.featured-content' ).featuredslider({ 113 selector: '.featured-content-inner > article', 114 114 controlsContainer: '.featured-content' 115 } 115 }); 116 116 } 117 } 118 } 117 }); 118 })( jQuery );