( function( $ ) { "use strict"; $('.actions button.remove_button').bind('click', function(event){ $( '.main_content' ).css( 'background-image', '' ); }); wp.customize( 'title_color', function( value ) { value.bind( function( newval ) { $(".site-title a").css('color', newval); } ); } ); wp.customize( 'description_color', function( value ) { value.bind( function( newval ) { $(".site-description").css('color', newval); } ); } ); wp.customize( 'main_background_color', function( value ) { value.bind( function( newval ) { $('.main_content').css( 'background-color', newval ); } ); } ); wp.customize( 'footer_background_color', function( value ) { value.bind( function( newval ) { $('.footer').css( 'background-color', newval ); } ); } ); /* wp.customize( 'links_color', function( value ) { value.bind( function( newval ) { $(".record_body a").css( 'color', newval ); } ); } ); */ wp.customize( 'links_color', function( value ) { value.bind( function( to ) { var style, el; style = ''; // build the style element el = $( '.a-styles' ); // look for a matching style element that might already be there // add the style element into the DOM or replace the matching style element that is already there if ( el.length ) { el.replaceWith( style ); // style element already exists, so replace it } else { $( 'head' ).append( style ); // style element doesn't exist so add it } } ); } ); wp.customize( 'visited_links_color', function( value ) { value.bind( function( to ) { var style, el; style = ''; // build the style element el = $( '.visited-styles' ); // look for a matching style element that might already be there // add the style element into the DOM or replace the matching style element that is already there if ( el.length ) { el.replaceWith( style ); // style element already exists, so replace it } else { $( 'head' ).append( style ); // style element doesn't exist so add it } } ); } ); wp.customize( 'hover_links_color', function( value ) { value.bind( function( to ) { var style, el; style = ''; // build the style element el = $( '.hover-styles' ); // look for a matching style element that might already be there // add the style element into the DOM or replace the matching style element that is already there if ( el.length ) { el.replaceWith( style ); // style element already exists, so replace it } else { $( 'head' ).append( style ); // style element doesn't exist so add it } } ); } ); wp.customize( 'background_image', function( value ) { value.bind( function( newval ) { 0 === $.trim( newval ).length ? $( '.main_content' ).css( 'background-image', '' ) : $( '.main_content' ).css( 'background-image', 'url( ' + newval + ')' ); } ); } ); wp.customize( 'header_image', function( value ) { value.bind( function( newval ) { 0 === $.trim( newval ).length ? $( '.head' ).css( 'background-image', '' ) : $( '.head' ).css( 'background-image', 'url( ' + newval + ')' ); } ); } ); wp.customize( 'background_repeat', function( value ) { value.bind( function( newval ) { $('.main_content').css( 'background-repeat', newval ); } ); } ); wp.customize( 'background_position_x', function( value ) { value.bind( function( newval ) { $('.main_content').css( 'background-position', " top "+newval ); } ); } ); wp.customize( 'background_attachment', function( value ) { value.bind( function( newval ) { $('.main_content').css( 'background-attachment', newval ); } ); } ); } )( jQuery );