jQuery(document).ready(function($){ var adminBarHeight = 0; if ( $("#wpadminbar").length != 0 ){ var adminBarHeight = $('#wpadminbar').height(); } var mysticky_welcomebar_height = adminBarHeight + jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); if( jQuery( '.mysticky-welcomebar-fixed' ).data('position') == 'top' ) { jQuery( '.mysticky-welcomebar-entry-effect-slide-in.mysticky-welcomebar-fixed' ).css( 'top', '-' + mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-entry-effect-slide-in.mysticky-welcomebar-fixed' ).css( 'bottom', '-' + mysticky_welcomebar_height + 'px' ); } var divi_topbar_height = $( '.et_fixed_nav #top-header' ).outerHeight(); var divi_total_height = mysticky_welcomebar_height + divi_topbar_height; var welcombar_aftersubmission = $( '.mysticky-welcomebar-fixed' ).data('aftersubmission'); if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ var welcomebar_storage = localStorage.getItem("welcomebar_close"); } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); } else { sessionStorage.removeItem('welcomebar_close'); localStorage.removeItem('welcomebar_close'); var welcomebar_storage = null; } if ( welcomebar_storage === null ){ var after_trigger = jQuery( '.mysticky-welcomebar-fixed' ).data('after-triger'); jQuery( 'body' ).addClass( 'mysticky-welcomebar-apper' ); if ( after_trigger == 'after_a_few_seconds' ) { if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { if ( $( window ).width() > 767 ) { var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); setTimeout(function(){ jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', (adminBarHeight + 0) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' ); jQuery( 'head' ).append( '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } }, trigger_sec ); } } } if ( $( window ).width() < 767 ) { if ( after_trigger == 'after_a_few_seconds' ) { if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); setTimeout(function(){ jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } }, trigger_sec ); } } } mystickyelements_present(); } $( window ).resize( function(){ var mysticky_welcomebar_height = jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ var welcomebar_storage = localStorage.getItem("welcomebar_close"); } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); } else { sessionStorage.removeItem('welcomebar_close'); localStorage.removeItem('welcomebar_close'); var welcomebar_storage = null; } if ( welcomebar_storage === null ){ var after_trigger = jQuery( '.mysticky-welcomebar-fixed' ).data('after-triger'); if ( ! $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-notapper' ) ) { jQuery( 'body' ).addClass( 'mysticky-welcomebar-apper' ); } else { jQuery( 'body' ).removeClass( 'mysticky-welcomebar-apper' ); } if ( after_trigger == 'after_a_few_seconds' ) { var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); if ( $( window ).width() < 767 ) { if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { setTimeout(function(){ jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } }, trigger_sec ); } } else { if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { setTimeout(function(){ jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.mysticky-welcomebar-apper.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' ); jQuery( 'head' ).append( '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); jQuery( '#mysticky_divi_style' ).remove(); jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } }, trigger_sec ); } } } mystickyelements_present(); } } ); jQuery(window).on( 'scroll', function(){ if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ var welcomebar_storage = localStorage.getItem("welcomebar_close"); } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); } else { sessionStorage.removeItem('welcomebar_close'); localStorage.removeItem('welcomebar_close'); var welcomebar_storage = null; } if ( welcomebar_storage === null ){ var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); if ( welcombar_position == 'top' ) { $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } if ( after_trigger === 'after_scroll' ) { var scroll = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()); var after_scroll_val = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec'); var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); if( scroll > after_scroll_val ) { if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { if ( $( window ).width() > 767 ) { jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', (adminBarHeight+ 0 ) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } } } if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { if ( $( window ).width() < 767 ) { jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); if ( welcombar_position == 'top' ) { jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight +0 ) + 'px' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-bottom', '' ); $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); } else { jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); $( 'html' ).css( 'margin-top', '' ); $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); } } } } } mystickyelements_present(); } }); jQuery( '.mysticky-welcomebar-close, .mysticky-welcomebar-btn a' ).on( 'click', function(){ /* Submit contact lead form */ var flag = true; var trigger_sec = 100; var welcomebar_widget = 0; if( jQuery(".mysticky-welcomebar-lead-content").length > 0 && !$(this).hasClass("mysticky-welcomebar-close")){ if( jQuery('#contact-lead-name-'+welcomebar_widget).val() != '' && ( jQuery('#contact-lead-phone-'+welcomebar_widget).val() != '' || jQuery('#contact-lead-email-'+welcomebar_widget).val() != '' )){ if( jQuery('#contact-lead-email-'+welcomebar_widget).css("display") != 'none' && IsEmail(jQuery('#contact-lead-email-'+welcomebar_widget).val()) != true ){ if( $(".input-error").length ){ $(".input-error").remove(); } $( '