customizer.js 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. ( function( $ ) {
  9. // Site title.
  10. wp.customize( 'blogname', function( value ) {
  11. value.bind( function( to ) {
  12. $( '.site-title a' ).text( to );
  13. } );
  14. } );
  15. // Site description.
  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 a, .site-description' ).css( {
  26. 'clip': 'rect(1px, 1px, 1px, 1px)',
  27. 'position': 'absolute'
  28. } );
  29. } else {
  30. $( '.site-title a, .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 );