morphext
2 years ago
detectmobilebrowser.js
2 years ago
iris-script.js
2 years ago
jquery.star-rating-svg.min.js
3 years ago
mystickymenu-admin.js
2 years ago
mystickymenu.js
2 years ago
mystickymenu.min.js
5 years ago
select2.min.js
2 years ago
slick.min.js
2 years ago
welcomebar-front.js
2 years ago
welcomebar-front.js
484 lines
| 1 | jQuery(document).ready(function($){ |
| 2 | |
| 3 | var adminBarHeight = 0; |
| 4 | if ( $("#wpadminbar").length != 0 ){ |
| 5 | var adminBarHeight = $('#wpadminbar').height(); |
| 6 | } |
| 7 | var mysticky_welcomebar_height = adminBarHeight + jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 8 | if( jQuery( '.mysticky-welcomebar-fixed' ).data('position') == 'top' ) { |
| 9 | jQuery( '.mysticky-welcomebar-entry-effect-slide-in.mysticky-welcomebar-fixed' ).css( 'top', '-' + mysticky_welcomebar_height + 'px' ); |
| 10 | } else { |
| 11 | jQuery( '.mysticky-welcomebar-entry-effect-slide-in.mysticky-welcomebar-fixed' ).css( 'bottom', '-' + mysticky_welcomebar_height + 'px' ); |
| 12 | } |
| 13 | var divi_topbar_height = $( '.et_fixed_nav #top-header' ).outerHeight(); |
| 14 | var divi_total_height = mysticky_welcomebar_height + divi_topbar_height; |
| 15 | var welcombar_aftersubmission = $( '.mysticky-welcomebar-fixed' ).data('aftersubmission'); |
| 16 | if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ |
| 17 | var welcomebar_storage = localStorage.getItem("welcomebar_close"); |
| 18 | } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { |
| 19 | var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); |
| 20 | } else { |
| 21 | sessionStorage.removeItem('welcomebar_close'); |
| 22 | localStorage.removeItem('welcomebar_close'); |
| 23 | var welcomebar_storage = null; |
| 24 | } |
| 25 | if ( welcomebar_storage === null ){ |
| 26 | |
| 27 | var after_trigger = jQuery( '.mysticky-welcomebar-fixed' ).data('after-triger'); |
| 28 | |
| 29 | jQuery( 'body' ).addClass( 'mysticky-welcomebar-apper' ); |
| 30 | |
| 31 | if ( after_trigger == 'after_a_few_seconds' ) { |
| 32 | |
| 33 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { |
| 34 | if ( $( window ).width() > 767 ) { |
| 35 | var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; |
| 36 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 37 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 38 | |
| 39 | setTimeout(function(){ |
| 40 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 41 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 42 | if ( welcombar_position == 'top' ) { |
| 43 | |
| 44 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 45 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', (adminBarHeight + 0) + 'px' ); |
| 46 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 47 | $( 'html' ).css( 'margin-bottom', '' ); |
| 48 | jQuery( '#mysticky_divi_style' ).remove(); |
| 49 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' ); |
| 50 | jQuery( 'head' ).append( '<style id="mysticky_divi_style" type="text/css">.et_fixed_nav #main-header {top: ' + welcombar_height + 'px !important}.et_fixed_nav #top-header + #main-header{top: ' + divi_total_height + 'px !important}</style>' ); |
| 51 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 52 | $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 53 | } else { |
| 54 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 55 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 56 | $( 'html' ).css( 'margin-top', '' ); |
| 57 | jQuery( '#mysticky_divi_style' ).remove(); |
| 58 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); |
| 59 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 60 | } |
| 61 | }, trigger_sec ); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | if ( $( window ).width() < 767 ) { |
| 66 | if ( after_trigger == 'after_a_few_seconds' ) { |
| 67 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { |
| 68 | var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; |
| 69 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 70 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 71 | setTimeout(function(){ |
| 72 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 73 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 74 | jQuery( '#mysticky_divi_style' ).remove(); |
| 75 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); |
| 76 | if ( welcombar_position == 'top' ) { |
| 77 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); |
| 78 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 79 | $( 'html' ).css( 'margin-bottom', '' ); |
| 80 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 81 | $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 82 | } else { |
| 83 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 84 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 85 | $( 'html' ).css( 'margin-top', '' ); |
| 86 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 87 | } |
| 88 | }, trigger_sec ); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | mystickyelements_present(); |
| 93 | } |
| 94 | $( window ).resize( function(){ |
| 95 | |
| 96 | var mysticky_welcomebar_height = jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 97 | if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ |
| 98 | var welcomebar_storage = localStorage.getItem("welcomebar_close"); |
| 99 | } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { |
| 100 | var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); |
| 101 | } else { |
| 102 | sessionStorage.removeItem('welcomebar_close'); |
| 103 | localStorage.removeItem('welcomebar_close'); |
| 104 | var welcomebar_storage = null; |
| 105 | } |
| 106 | if ( welcomebar_storage === null ){ |
| 107 | var after_trigger = jQuery( '.mysticky-welcomebar-fixed' ).data('after-triger'); |
| 108 | if ( ! $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-notapper' ) ) { |
| 109 | jQuery( 'body' ).addClass( 'mysticky-welcomebar-apper' ); |
| 110 | } else { |
| 111 | jQuery( 'body' ).removeClass( 'mysticky-welcomebar-apper' ); |
| 112 | } |
| 113 | if ( after_trigger == 'after_a_few_seconds' ) { |
| 114 | var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; |
| 115 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 116 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 117 | if ( $( window ).width() < 767 ) { |
| 118 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { |
| 119 | setTimeout(function(){ |
| 120 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 121 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 122 | jQuery( '#mysticky_divi_style' ).remove(); |
| 123 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); |
| 124 | if ( welcombar_position == 'top' ) { |
| 125 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); |
| 126 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 127 | $( 'html' ).css( 'margin-bottom', '' ); |
| 128 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 129 | $( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 130 | } else { |
| 131 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 132 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 133 | $( 'html' ).css( 'margin-top', '' ); |
| 134 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 135 | } |
| 136 | }, trigger_sec ); |
| 137 | } |
| 138 | } else { |
| 139 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { |
| 140 | setTimeout(function(){ |
| 141 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 142 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 143 | if ( welcombar_position == 'top' ) { |
| 144 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); |
| 145 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 146 | $( 'html' ).css( 'margin-bottom', '' ); |
| 147 | jQuery( '#mysticky_divi_style' ).remove(); |
| 148 | jQuery( '.mysticky-welcomebar-apper.et_fixed_nav #top-header' ).css( 'top', welcombar_height + 'px' ); |
| 149 | jQuery( 'head' ).append( '<style id="mysticky_divi_style" type="text/css">.mysticky-welcomebar-apper.et_fixed_nav #main-header {top: ' + welcombar_height + 'px !important}.mysticky-welcomebar-apper.et_fixed_nav #top-header + #main-header{top: ' + divi_total_height + 'px !important}</style>' ); |
| 150 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 151 | $( '.mysticky-welcomebar-apper #mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 152 | } else { |
| 153 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 154 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 155 | $( 'html' ).css( 'margin-top', '' ); |
| 156 | jQuery( '#mysticky_divi_style' ).remove(); |
| 157 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); |
| 158 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 159 | } |
| 160 | }, trigger_sec ); |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | mystickyelements_present(); |
| 165 | } |
| 166 | } ); |
| 167 | |
| 168 | jQuery(window).on( 'scroll', function(){ |
| 169 | if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ |
| 170 | var welcomebar_storage = localStorage.getItem("welcomebar_close"); |
| 171 | } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { |
| 172 | var welcomebar_storage = sessionStorage.getItem("welcomebar_close"); |
| 173 | } else { |
| 174 | sessionStorage.removeItem('welcomebar_close'); |
| 175 | localStorage.removeItem('welcomebar_close'); |
| 176 | var welcomebar_storage = null; |
| 177 | } |
| 178 | if ( welcomebar_storage === null ){ |
| 179 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 180 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 181 | if ( welcombar_position == 'top' ) { |
| 182 | $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 183 | } |
| 184 | if ( after_trigger === 'after_scroll' ) { |
| 185 | var scroll = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()); |
| 186 | var after_scroll_val = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec'); |
| 187 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 188 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 189 | if( scroll > after_scroll_val ) { |
| 190 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-desktop' ) ) { |
| 191 | if ( $( window ).width() > 767 ) { |
| 192 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 193 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 194 | if ( welcombar_position == 'top' ) { |
| 195 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', (adminBarHeight+ 0 ) + 'px' ); |
| 196 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 197 | $( 'html' ).css( 'margin-bottom', '' ); |
| 198 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 199 | $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 200 | } else { |
| 201 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 202 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 203 | $( 'html' ).css( 'margin-top', '' ); |
| 204 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | if ( $( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { |
| 209 | if ( $( window ).width() < 767 ) { |
| 210 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-animation' ); |
| 211 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 212 | if ( welcombar_position == 'top' ) { |
| 213 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight +0 ) + 'px' ); |
| 214 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 215 | $( 'html' ).css( 'margin-bottom', '' ); |
| 216 | $( 'html' ).attr( 'style', 'margin-top: ' + mysticky_welcomebar_height + 'px !important' ); |
| 217 | $( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 218 | } else { |
| 219 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '0' ); |
| 220 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'opacity', '1' ); |
| 221 | $( 'html' ).css( 'margin-top', '' ); |
| 222 | $( 'html' ).attr( 'style', 'margin-bottom: ' + mysticky_welcomebar_height + 'px !important' ); |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | mystickyelements_present(); |
| 229 | } |
| 230 | |
| 231 | }); |
| 232 | |
| 233 | jQuery( '.mysticky-welcomebar-close, .mysticky-welcomebar-btn a' ).on( 'click', function( e ){ |
| 234 | /* Submit contact lead form */ |
| 235 | var flag = true; |
| 236 | var trigger_sec = 100; |
| 237 | var welcomebar_widget = 0; |
| 238 | var welcombar_rediect = $( '.mysticky-welcomebar-fixed' ).data('rediect'); |
| 239 | if (welcombar_rediect == 'close_bar') { |
| 240 | e.preventDefault(); |
| 241 | } |
| 242 | if( jQuery(".mysticky-welcomebar-lead-content").length > 0 && !$(this).hasClass("mysticky-welcomebar-close")){ |
| 243 | |
| 244 | if( jQuery('#contact-lead-name-'+welcomebar_widget).val() != '' && ( jQuery('#contact-lead-phone-'+welcomebar_widget).val() != '' || jQuery('#contact-lead-email-'+welcomebar_widget).val() != '' )){ |
| 245 | |
| 246 | if( jQuery('#contact-lead-email-'+welcomebar_widget).css("display") != 'none' && IsEmail(jQuery('#contact-lead-email-'+welcomebar_widget).val()) != true ){ |
| 247 | |
| 248 | if( $(".input-error").length ){ |
| 249 | $(".input-error").remove(); |
| 250 | } |
| 251 | |
| 252 | $( '<div class="input-error"><span>Please, enter valid email</span></div>' ).insertAfter( jQuery('#contact-lead-email-' + welcomebar_widget) ); |
| 253 | flag = false; |
| 254 | } |
| 255 | |
| 256 | |
| 257 | if( jQuery('#contact-lead-phone-'+welcomebar_widget).css("display") != 'none' && validatePhone(jQuery('#contact-lead-phone-'+welcomebar_widget).val()) != true ){ |
| 258 | if( $(".input-error").length ){ |
| 259 | $(".input-error").remove(); |
| 260 | } |
| 261 | $( '<div class="input-error"><span>Please, enter valid phone</span></div>' ).insertAfter( jQuery('#contact-lead-phone-'+welcomebar_widget) ); |
| 262 | flag=false; |
| 263 | } |
| 264 | |
| 265 | if (flag == true) { |
| 266 | var data = []; |
| 267 | data["contact_name"] = jQuery('#contact-lead-name-'+welcomebar_widget).val(); |
| 268 | data["contact_email"] = jQuery('#contact-lead-email-'+welcomebar_widget).val(); |
| 269 | data["contact_phone"] = jQuery('#contact-lead-phone-'+welcomebar_widget).val(); |
| 270 | data["contact_page_link"] = jQuery('#contact-lead-pagelink-'+welcomebar_widget).val(); |
| 271 | |
| 272 | |
| 273 | var sucess_message = $( '.mysticky-welcomebar-fixed' ).data('show-success-message'); |
| 274 | if ( sucess_message == 1) { |
| 275 | $(".mysticky-welcomebar-fixed .mysticky-welcomebar-lead-content").hide(); |
| 276 | $(".mysticky-welcomebar-fixed .mysticky-welcomebar-content p").hide(); |
| 277 | $(".mysticky-welcomebar-fixed .mysticky-welcomebar-btn.contact-lead-button").hide(); |
| 278 | $(".mysticky-welcomebar-fixed .mysticky-welcomebar-thankyou-content").show(); |
| 279 | $(".mysticky-welcomebar-fixed .mysticky-welcomebar-thankyou-content p").show(); |
| 280 | } |
| 281 | var trigger_sec = 2000; |
| 282 | jQuery.ajax({ |
| 283 | url: welcomebar_frontjs.ajaxurl, |
| 284 | type:'post', |
| 285 | data: 'contact_name='+data["contact_name"]+'&contact_email='+data["contact_email"]+'&contact_phone='+data["contact_phone"]+'&action=stickymenu_contact_lead_form&widget_id=' + welcomebar_widget + '&page_link='+ data["contact_page_link"]+'&save_form_lead=1&wpnonce=' + welcomebar_frontjs.ajax_nonce, |
| 286 | success: function( data ){ |
| 287 | $(".mysticky-welcomebar-widget-"+welcomebar_widget+" .mysticky-welcomebar-fixed-wrap").css("margin-bottom","0"); |
| 288 | jQuery('#contact-lead-name-'+welcomebar_widget).val(''); |
| 289 | jQuery('#contact-lead-email-'+welcomebar_widget).val(''); |
| 290 | jQuery('#contact-lead-phone-'+welcomebar_widget).val(''); |
| 291 | |
| 292 | }, |
| 293 | }); |
| 294 | }else{ |
| 295 | $(".mysticky-welcomebar-widget-"+welcomebar_widget+" .mysticky-welcomebar-fixed-wrap").css("margin-bottom","10px"); |
| 296 | return false; |
| 297 | } |
| 298 | |
| 299 | |
| 300 | }else{ |
| 301 | localStorage.removeItem('welcomebar_close_' + welcomebar_widget); |
| 302 | sessionStorage.removeItem('welcomebar_close_' + welcomebar_widget); |
| 303 | |
| 304 | if($(".input-error").length){ |
| 305 | $(".input-error").remove(); |
| 306 | } |
| 307 | |
| 308 | if( jQuery('#contact-lead-name-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-name-'+welcomebar_widget).val() == '' && jQuery('#contact-lead-email-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-email-'+welcomebar_widget).val() == '' ){ |
| 309 | |
| 310 | $( '<div class="input-error"><span>Please enter your name and email</span></div>' ).insertAfter( jQuery('#contact-lead-name-'+welcomebar_widget) ); |
| 311 | flag=false; |
| 312 | |
| 313 | }else if( jQuery('#contact-lead-name-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-name-'+welcomebar_widget).val() == '' && jQuery('#contact-lead-phone-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-phone-'+welcomebar_widget).val() == '' ){ |
| 314 | |
| 315 | $( '<div class="input-error"><span>Please enter your name and phone</span></div>' ).insertAfter( jQuery('#contact-lead-name-'+welcomebar_widget) ); |
| 316 | flag=false; |
| 317 | |
| 318 | }else if( jQuery('#contact-lead-name-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-name-'+welcomebar_widget).val() == '' ){ |
| 319 | |
| 320 | $( '<div class="input-error"><span>Please enter your name</span></div>' ).insertAfter( jQuery('#contact-lead-name-'+welcomebar_widget) ); |
| 321 | flag=false; |
| 322 | |
| 323 | }else if( jQuery('#contact-lead-email-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-email-'+welcomebar_widget).val() == '' ){ |
| 324 | |
| 325 | $( '<div class="input-error"><span>Please, enter your email</span></div>' ).insertAfter( jQuery('#contact-lead-email-'+welcomebar_widget) ); |
| 326 | flag=false; |
| 327 | |
| 328 | }else if( jQuery('#contact-lead-phone-'+welcomebar_widget).css("display") != 'none' && jQuery('#contact-lead-phone-'+welcomebar_widget).val() == '' ){ |
| 329 | |
| 330 | $( '<div class="input-error"><span>Please, enter your phone</span></div>' ).insertAfter( jQuery('#contact-lead-phone-'+welcomebar_widget) ); |
| 331 | flag=false; |
| 332 | |
| 333 | } |
| 334 | |
| 335 | if(flag==false){ |
| 336 | |
| 337 | $(".mysticky-welcomebar-widget-"+welcomebar_widget+" .mysticky-welcomebar-fixed-wrap").css("margin-bottom","10px"); |
| 338 | } else{ |
| 339 | $(".mysticky-welcomebar-widget-"+welcomebar_widget+" .mysticky-welcomebar-fixed-wrap").css("margin-bottom","0"); |
| 340 | } |
| 341 | return false; |
| 342 | } |
| 343 | }else{ |
| 344 | if( $(this).hasClass("mysticky-welcomebar-close") ){ |
| 345 | localStorage.setItem('is_close_trigger_' + welcomebar_widget, 'yes'); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | setTimeout(function(){ |
| 350 | if( welcombar_aftersubmission != 'show_welcomebar_every_page' ){ |
| 351 | if( welcombar_aftersubmission == 'dont_show_welcomebar' ){ |
| 352 | sessionStorage.removeItem('welcomebar_close'); |
| 353 | localStorage.setItem('welcomebar_close', 'close'); |
| 354 | } else if( welcombar_aftersubmission == 'show_welcomebar_next_visit' ) { |
| 355 | localStorage.removeItem('welcomebar_close'); |
| 356 | sessionStorage.setItem('welcomebar_close', 'close'); |
| 357 | } |
| 358 | } |
| 359 | var welcombar_position = $( '.mysticky-welcomebar-fixed' ).data('position'); |
| 360 | var welcombar_height = $( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 361 | jQuery( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-notapper' ); |
| 362 | jQuery( 'body' ).removeClass( 'mysticky-welcomebar-apper' ); |
| 363 | jQuery( '.mysticky-welcomebar-fixed' ).slideUp( 'slow' ); |
| 364 | if ( welcombar_position == 'top' ) { |
| 365 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', '-' + mysticky_welcomebar_height + 'px' ); |
| 366 | } else { |
| 367 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'bottom', '-' + mysticky_welcomebar_height + 'px' ); |
| 368 | } |
| 369 | jQuery( '#mysticky_divi_style' ).remove(); |
| 370 | jQuery( '.et_fixed_nav #top-header' ).css( 'top', '' ); |
| 371 | jQuery( 'html' ).css( 'margin-top', '' ); |
| 372 | jQuery( 'html' ).css( 'margin-bottom', '' ); |
| 373 | $( '#mysticky-nav' ).css( 'top', '0px' ); |
| 374 | /*if mystickyelements show*/ |
| 375 | var mystickyelements_show = $( '.mystickyelements-fixed' ).length; |
| 376 | if( mystickyelements_show && $( window ).width() <= 1024 && $( '.mystickyelements-fixed' ).hasClass( 'mystickyelements-position-mobile-top' ) && welcombar_position == 'top' ) { |
| 377 | var mystickyelements_height = $( '.mystickyelements-fixed' ).height(); |
| 378 | $( '.mystickyelements-fixed' ).css( 'top', '' ); |
| 379 | $( 'html' ).attr( 'style', 'margin-top: ' + mystickyelements_height + 'px !important' ); |
| 380 | } |
| 381 | |
| 382 | }, trigger_sec ); |
| 383 | jQuery('#contact-lead-name-'+welcomebar_widget).val(''); |
| 384 | jQuery('#contact-lead-email-'+welcomebar_widget).val(''); |
| 385 | jQuery('#contact-lead-phone-'+welcomebar_widget).val(''); |
| 386 | } ); |
| 387 | }); |
| 388 | function mystickyelements_present() { |
| 389 | var after_trigger = jQuery( '.mysticky-welcomebar-fixed' ).data('after-triger'); |
| 390 | var mystickyelements_show = jQuery( '.mystickyelements-fixed' ).length; |
| 391 | var welcombar_position = jQuery( '.mysticky-welcomebar-fixed' ).data('position'); |
| 392 | var adminBarHeight = 0; |
| 393 | if ( jQuery("#wpadminbar").length != 0 ){ |
| 394 | var adminBarHeight = jQuery('#wpadminbar').height(); |
| 395 | } |
| 396 | |
| 397 | if ( jQuery( window ).width() <= 600 && jQuery(window).scrollTop() != 0 && welcombar_position == 'top') { |
| 398 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', '0px' ); |
| 399 | var welcombar_height = jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 400 | |
| 401 | if (jQuery( '.mysticky-welcomebar-fixed' ).css('display') === 'none') { |
| 402 | welcombar_height= 0; |
| 403 | } |
| 404 | jQuery( '#mysticky-nav' ).css( 'top', welcombar_height + 'px' ); |
| 405 | |
| 406 | } else if ( welcombar_position == 'top' ) { |
| 407 | var mysticky_welcomebar_height = adminBarHeight + jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 408 | if (jQuery( '.mysticky-welcomebar-fixed' ).css('display') === 'none') { |
| 409 | mysticky_welcomebar_height= adminBarHeight + 0; |
| 410 | } |
| 411 | jQuery( '.mysticky-welcomebar-fixed' ).css( 'top', ( adminBarHeight + 0) + 'px' ); |
| 412 | jQuery( '#mysticky-nav' ).css( 'top', mysticky_welcomebar_height + 'px' ); |
| 413 | } |
| 414 | if( mystickyelements_show ) { |
| 415 | |
| 416 | var welcombar_height = jQuery( '.mysticky-welcomebar-fixed' ).outerHeight(); |
| 417 | var mystickyelements_height = jQuery( '.mystickyelements-fixed' ).height(); |
| 418 | var mystickyelements_total_height = welcombar_height + mystickyelements_height; |
| 419 | if ( jQuery( window ).width() <= 1024 && jQuery( '.mystickyelements-fixed' ).hasClass( 'mystickyelements-position-mobile-top' ) ) { |
| 420 | if ( after_trigger == 'after_a_few_seconds' ) { |
| 421 | if ( jQuery( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { |
| 422 | var trigger_sec = jQuery( '.mysticky-welcomebar-fixed' ).data('triger-sec') * 1000; |
| 423 | setTimeout(function(){ |
| 424 | if ( welcombar_position == 'top' ) { |
| 425 | jQuery( '.mystickyelements-fixed' ).css( 'top', welcombar_height ); |
| 426 | jQuery( 'html' ).attr( 'style', 'margin-top: ' + mystickyelements_total_height + 'px !important' ); |
| 427 | } else { |
| 428 | jQuery( '.mystickyelements-fixed' ).css( 'top', '' ); |
| 429 | jQuery( 'html' ).attr( 'style', 'margin-bottom: ' + welcombar_height + 'px !important' ); |
| 430 | } |
| 431 | }, trigger_sec ); |
| 432 | } |
| 433 | } else if ( after_trigger === 'after_scroll' ) { |
| 434 | var scroll = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()); |
| 435 | var after_scroll_val = $( '.mysticky-welcomebar-fixed' ).data('triger-sec'); |
| 436 | if( scroll > after_scroll_val ) { |
| 437 | if ( jQuery( '.mysticky-welcomebar-fixed' ).hasClass( 'mysticky-welcomebar-display-mobile' ) ) { |
| 438 | if ( welcombar_position == 'top' ) { |
| 439 | jQuery( '.mystickyelements-fixed' ).css( 'top', welcombar_height ); |
| 440 | jQuery( 'html' ).attr( 'style', 'margin-top: ' + mystickyelements_total_height + 'px !important' ); |
| 441 | } else { |
| 442 | jQuery( '.mystickyelements-fixed' ).css( 'top', '' ); |
| 443 | jQuery( 'html' ).attr( 'style', 'margin-bottom: ' + welcombar_height + 'px !important' ); |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | jQuery(".mysticky-welcomebar-fixed").on( |
| 452 | "animationend MSAnimationEnd webkitAnimationEnd oAnimationEnd", |
| 453 | function() { |
| 454 | jQuery(this).removeClass("animation-start"); |
| 455 | } |
| 456 | ); |
| 457 | jQuery(document).ready(function() { |
| 458 | var container = jQuery(".mysticky-welcomebar-fixed"); |
| 459 | var refreshId = setInterval(function() { |
| 460 | container.addClass("animation-start"); |
| 461 | }, 3500); |
| 462 | }); |
| 463 | |
| 464 | function IsEmail(email) { |
| 465 | var regex = |
| 466 | /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; |
| 467 | if (!regex.test(email)) { |
| 468 | return false; |
| 469 | } |
| 470 | else { |
| 471 | return true; |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | function validatePhone(txtPhone) { |
| 476 | var a = txtPhone; |
| 477 | var filter = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/; |
| 478 | if (filter.test(a)) { |
| 479 | return true; |
| 480 | } |
| 481 | else { |
| 482 | return false; |
| 483 | } |
| 484 | } |