summaryrefslogtreecommitdiff
path: root/inc/builder/type/header/site-identity/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'inc/builder/type/header/site-identity/assets/js')
-rw-r--r--inc/builder/type/header/site-identity/assets/js/minified/customizer-preview.min.js1
-rw-r--r--inc/builder/type/header/site-identity/assets/js/unminified/customizer-preview.js71
2 files changed, 72 insertions, 0 deletions
diff --git a/inc/builder/type/header/site-identity/assets/js/minified/customizer-preview.min.js b/inc/builder/type/header/site-identity/assets/js/minified/customizer-preview.min.js
new file mode 100644
index 0000000..f78106d
--- /dev/null
+++ b/inc/builder/type/header/site-identity/assets/js/minified/customizer-preview.min.js
@@ -0,0 +1 @@
+!function(){wp.customize("astra-settings[different-mobile-logo]",function(t){t.bind(function(t){"1"==t?jQuery(".site-header").addClass("ast-has-mobile-header-logo"):jQuery(".site-header").removeClass("ast-has-mobile-header-logo")})}),wp.customize("astra-settings[title_tagline-margin]",function(t){t.bind(function(t){var e,i,o,a;""==t.desktop.bottom&&""==t.desktop.top&&""==t.desktop.left&&""==t.desktop.right&&""==t.tablet.bottom&&""==t.tablet.top&&""==t.tablet.left&&""==t.tablet.right&&""==t.mobile.bottom&&""==t.mobile.top&&""==t.mobile.left&&""==t.mobile.right||(e="",i=".ast-builder-layout-element .ast-site-identity",o=astraBuilderPreview.tablet_break_point||768,a=astraBuilderPreview.mobile_break_point||544,e+=i+" {",e+="margin-left: "+t.desktop.left+t["desktop-unit"]+";",e+="margin-right: "+t.desktop.right+t["desktop-unit"]+";",e+="margin-top: "+t.desktop.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.desktop.bottom+t["desktop-unit"]+";",e+="} ",e+="@media (max-width: "+o+"px) {",e+=i+" {",e+="margin-left: "+t.tablet.left+t["tablet-unit"]+";",e+="margin-right: "+t.tablet.right+t["tablet-unit"]+";",e+="margin-top: "+t.tablet.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.tablet.bottom+t["desktop-unit"]+";",e+="} ",e+="} ",e+="@media (max-width: "+a+"px) {",e+=i+" {",e+="margin-left: "+t.mobile.left+t["mobile-unit"]+";",e+="margin-right: "+t.mobile.right+t["mobile-unit"]+";",e+="margin-top: "+t.mobile.top+t["desktop-unit"]+";",e+="margin-bottom: "+t.mobile.bottom+t["desktop-unit"]+";",e+="} ",e+="} ",astra_add_dynamic_css("title_tagline-margin",e))})});astra_builder_visibility_css("title_tagline",'.ast-builder-layout-element[data-section="title_tagline"]')}(jQuery); \ No newline at end of file
diff --git a/inc/builder/type/header/site-identity/assets/js/unminified/customizer-preview.js b/inc/builder/type/header/site-identity/assets/js/unminified/customizer-preview.js
new file mode 100644
index 0000000..79f8b60
--- /dev/null
+++ b/inc/builder/type/header/site-identity/assets/js/unminified/customizer-preview.js
@@ -0,0 +1,71 @@
+/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra HF Builder.
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ wp.customize( 'astra-settings[different-mobile-logo]', function ( value ) {
+ value.bind( function ( newval ) {
+
+ if ( '1' == newval ) {
+ jQuery('.site-header').addClass( 'ast-has-mobile-header-logo' );
+ } else {
+ jQuery('.site-header').removeClass( 'ast-has-mobile-header-logo' );
+ }
+ } );
+ } );
+
+ // Margin.
+ wp.customize( 'astra-settings[title_tagline-margin]', function( value ) {
+ value.bind( function( margin ) {
+ if(
+ margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' ||
+ margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' ||
+ margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != ''
+ ) {
+ var dynamicStyle = '',
+ selector = '.ast-builder-layout-element .ast-site-identity',
+ tablet_break_point = astraBuilderPreview.tablet_break_point || 768,
+ mobile_break_point = astraBuilderPreview.mobile_break_point || 544;
+
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += selector + ' {';
+ dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ astra_add_dynamic_css( 'title_tagline-margin', dynamicStyle );
+ }
+ } );
+ } );
+
+ var section = 'title_tagline';
+ var visibility_selector = '.ast-builder-layout-element[data-section="title_tagline"]';
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( section, visibility_selector );
+} )( jQuery );