customizer.js (995B)
1 /** 2 * File customizer.js. 3 * 4 * Theme Customizer enhancements for a better user experience. 5 * 6 * Contains handlers to make Theme Customizer preview reload changes asynchronously. 7 */ 8 9 ( function( $ ) { 10 11 // Site title and description. 12 wp.customize( 'blogname', function( value ) { 13 value.bind( function( to ) { 14 $( '.site-title a' ).text( to ); 15 } ); 16 } ); 17 wp.customize( 'blogdescription', function( value ) { 18 value.bind( function( to ) { 19 $( '.site-description' ).text( to ); 20 } ); 21 } ); 22 23 // Header text color. 24 wp.customize( 'header_textcolor', function( value ) { 25 value.bind( function( to ) { 26 if ( 'blank' === to ) { 27 $( '.site-title, .site-description' ).css( { 28 'clip': 'rect(1px, 1px, 1px, 1px)', 29 'position': 'absolute' 30 } ); 31 } else { 32 $( '.site-title, .site-description' ).css( { 33 'clip': 'auto', 34 'position': 'relative' 35 } ); 36 $( '.site-title a, .site-description' ).css( { 37 'color': to 38 } ); 39 } 40 } ); 41 } ); 42 } )( jQuery );