customizer.js 1011 B

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