/**
 * willer-customizer.js
 *
 * author    Denis Franchi
 * package   Willer
 */

/* TABLE OF CONTENT
   1 - Site title
	 2 - Site description
	 3 - Header text color
     4 - Font-size logo
     5 - Height Footer
	 6 - Title Blog Slider Home page Willer
	 7 - Subtitle Blog Slider Home page Willer
	 Other
*/



// Function Refresh
( function( $ ) {
// 1 Site title
wp.customize( 'blogname', function( value ) {
	value.bind( function( to ) {
		$( '.site-title a' ).text( to );
	} );
} );

// 2 Site description
wp.customize( 'blogdescription', function( value ) {
	value.bind( function( to ) {
		$( '.site-description' ).text( to );
	} );
} );

// 3 Header text color
wp.customize( 'header_textcolor', function( value ) {
	value.bind( function( to ) {
		if ( 'blank' === to ) {
			$( '.site-title, .site-description' ).css( {
				'clip': 'rect(1px, 1px, 1px, 1px)',
				'position': 'absolute'
			} );
		} else {
			$( '.site-title, .site-description' ).css( {
				'clip': 'auto',
				'position': 'relative'
			} );
			
		}
	} );
} );


wp.customize('willer_font_size_logo', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-logo-header img').css('width', controlValue + 'px');
	});
});

// 6 Title Blog Slider Home page Willer
wp.customize( 'willer_title_blog_slider', function( value ) {
	value.bind( function( newval ) {
		$( 'h2.title-willer-blog' ).html( newval );

	} );
} );

// 7 Subtitle Blog Slider Home page Willer
wp.customize( 'willer_subtitle_blog_slider', function( value ) {
	value.bind( function( newval ) {
		$( 'h3.subtitle-willer-blog' ).html( newval );

	} );
} );

// Margin Top Section Seervices
wp.customize('willer_margin_top_services', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-services').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Seervices
wp.customize('willer_margin_bottom_services', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-services').css('margin-bottom', controlValue + 'em');
	});
});

// Width Images Services
wp.customize('willer_size_image_services', function(control) {
	control.bind(function( controlValue ) {
		$('.our-willer-services-img img').css('width', controlValue + 'px');
	});
});

// Margin Top Section Gallery
wp.customize('willer_margin_top_gallery', function(control) {
	control.bind(function( controlValue ) {
		$('.gallery-willer').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Gallery
wp.customize('willer_margin_bottom_gallery', function(control) {
	control.bind(function( controlValue ) {
		$('.gallery-willer').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section Testimonials
wp.customize('willer_margin_top_testimonial', function(control) {
	control.bind(function( controlValue ) {
		$('#willer-text-carousel').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Testimonials
wp.customize('willer_margin_bottom_testimonial', function(control) {
	control.bind(function( controlValue ) {
		$('#willer-text-carousel').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section About
wp.customize('willer_margin_top_about', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-about').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section About
wp.customize('willer_margin_bottom_about', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-about').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section Portfolio
wp.customize('willer_margin_top_portfolio', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-portfolio').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Portfolio
wp.customize('willer_margin_bottom_portfolio', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-portfolio').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section Team
wp.customize('willer_margin_top_team', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-team').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Team
wp.customize('willer_margin_bottom_team', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-team').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section Blog
wp.customize('willer_margin_top_blog', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-blog').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Blog
wp.customize('willer_margin_bottom_blog', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-blog').css('margin-bottom', controlValue + 'em');
	});
});

// Margin Top Section Parallax
wp.customize('willer_margin_top_parallax', function(control) {
	control.bind(function( controlValue ) {
		$('.willerparallaxn').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Parallax
wp.customize('willer_margin_bottom_parallax', function(control) {
	control.bind(function( controlValue ) {
		$('.willerparallaxn').css('margin-bottom', controlValue + 'em');
	});
});

// Height Section Parallax
wp.customize('willer_height_image_parallax', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-img-parallax').css('height', controlValue + 'px');
	});
});

// Font size menu
wp.customize('willer_font_size_menu', function(control) {
	control.bind(function( controlValue ) {
		$('#willer-menu-header ul.navbar-nav a').css('font-size', controlValue + 'px');
	});
});

// Font size title site
wp.customize('willer_font_size_title_site', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-description-logo a').css('font-size', controlValue + 'px');
	});
});

// Font size subtitle site
wp.customize('willer_font_size_subtitle_site', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-description-logo p').css('font-size', controlValue + 'px');
	});
});

// Background Color copyright Footer
wp.customize( 'willer_background_color_copyright_footer', function( value ) {
    value.bind( function( newval ) {
    $( '.willer-copyright' ).css( 'background-color', newval );
    } );
} );

// Color copyright Footer
wp.customize( 'willer_color_copyright_footer', function( value ) {
    value.bind( function( newval ) {
    $( '.willer-link-copyright a,.willer-text-copyright p' ).css( 'color', newval );
    } );
} );

// Font Size Logo Footer
wp.customize('willer_logo_footer', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-logo-footer img').css('width', controlValue + 'px');
	});
});

// Margin Top Section Slider
wp.customize('willer_margin_top_slider', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-section-slider').css('margin-top', controlValue + 'em');
	});
});

// Margin Bottom Section Slider
wp.customize('willer_margin_bottom_slider', function(control) {
	control.bind(function( controlValue ) {
		$('.willer-section-slider').css('margin-bottom', controlValue + 'em');
	});
});


// End Function Refresh
} )( jQuery );






