Changeset 39220
- Timestamp:
- 11/14/2016 11:22:25 AM (8 years ago)
- Location:
- trunk/src/wp-content/themes/twentyseventeen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js
r38986 r39220 103 103 } ); 104 104 } ); 105 106 // Whether a header image is available. 107 function hasHeaderImage() { 108 var image = wp.customize( 'header_image' )(); 109 return '' !== image && 'remove-header' !== image; 110 } 111 112 // Whether a header video is available. 113 function hasHeaderVideo() { 114 var externalVideo = wp.customize( 'external_header_video' )(), 115 video = wp.customize( 'header_video' )(); 116 117 return '' !== externalVideo || ( 0 !== video && '' !== video ); 118 } 119 120 // Toggle a body class if a custom header exists. 121 $.each( [ 'external_header_video', 'header_image', 'header_video' ], function( index, settingId ) { 122 wp.customize( settingId, function( setting ) { 123 setting.bind(function() { 124 if ( hasHeaderImage() || ( hasHeaderVideo() && $( 'body' ).hasClass( 'twentyseventeen-front-page' ) ) ) { 125 $( document.body ).addClass( 'has-header-image' ); 126 } else { 127 $( document.body ).removeClass( 'has-header-image' ); 128 } 129 } ); 130 } ); 131 } ); 132 105 133 } )( jQuery ); -
trunk/src/wp-content/themes/twentyseventeen/style.css
r39216 r39220 1691 1691 } 1692 1692 1693 /* Hides div in Customizer preview when header images or videos change. */ 1694 1693 1695 body:not(.has-header-image) .custom-header-image { 1694 padding: 5% 0;1696 display: none; 1695 1697 } 1696 1698
Note: See TracChangeset
for help on using the changeset viewer.