jQuery(window).on('load', function(){ jQuery("#mask").fadeOut(1100); jQuery("body").css("overflow-y","scroll"); jQuery("body").css("overflow-x","hidden"); }); function banner_resize() { var h = (642 * jQuery(window).width())/1092; jQuery('.banner-bg__svg-holder').width(jQuery(window).width()); jQuery('.banner-bg__svg-holder').height(h); } (function(jQuery) { "use strict"; jQuery('.navbar__list_dropdown-menu').hide(); jQuery('a[href^="tel:"]').click(function(event) { // $(this).html('and I didnt scroll to the top!'); // return false; }); /*setTimeout(function(){ var __ww = jQuery('body').width(); var _custom_w = 200; if(__ww < 450){ _custom_w = 150; } presize('.navbar-brand .logo', _custom_w , 70); presize('.navbar-brand .micro-logo' , _custom_w , 70); },250);*/ banner_resize(); function togglemenu(){ jQuery(".navigation-wrap").removeClass('no-transition'); jQuery('.menu-right').toggleClass('right-open'); jQuery('.navigation-wrap').toggleClass('navigation-wrap__open'); if (jQuery('.navigation-wrap').hasClass('navigation-wrap__open')) { jQuery(this).attr('aria-expanded', true); jQuery("body").css("overflow","hidden"); } else { jQuery(this).attr('aria-expanded', false); jQuery("body").css("overflow-y","scroll"); } } jQuery('.navbar__link').not('.dropdown-toggle').click(function (e) { e.stopPropagation(); }); jQuery('.navbar-toggle').click(function(e) { e.stopPropagation(); if(jQuery(this).hasClass('slide-active')){ jQuery('body , html').removeClass('noscroll'); jQuery(this).removeClass('slide-active'); jQuery('.navbar-toggle i').removeClass('fa-close'); jQuery('.navbar-toggle i').addClass('fa-bars'); if(jQuery(window).width() > 580){ jQuery('.officer-mob-wrap').fadeIn(); } if(jQuery(window).width() > 358){ jQuery('.mk-apply__btn').not('.mk-apply__btn_hide').fadeIn(); } } else{ jQuery('body , html').addClass('noscroll'); jQuery(this).addClass('slide-active'); jQuery('.navbar-toggle i').removeClass('fa-bars'); jQuery('.navbar-toggle i').addClass('fa-close'); jQuery('.officer-mob-wrap').hide(); jQuery('.mk-apply__btn').hide(); } togglemenu(); }); // if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { if (jQuery(window).width() <= 1100) { jQuery('.dropdown').click(function(e) { e.stopPropagation(); if(jQuery(this).hasClass('open')){ var _this = jQuery(this); // _this.toggleClass('open'); jQuery(this).find('.dropdown-menu').stop().slideUp(300 , function(){ _this.removeClass('open'); }); }else{ jQuery('.dropdown-menu').slideUp('fast'); jQuery('.dropdown').delay(1500).removeClass('open'); jQuery(this).addClass('open'); jQuery(this).find('.dropdown-menu').stop().slideDown(); } }); } else { // menu item hover jQuery('.dropdown').mouseover(function() { jQuery(this).addClass('open'); jQuery(this).find('.dropdown-menu').stop().slideDown(); }).mouseleave(function() { var _this = jQuery(this); jQuery(this).find('.dropdown-menu').stop().slideUp(300, function() { _this.removeClass('open'); }); }); } /* var header = jQuery(".navigation-wrap"); jQuery(window).scroll(function() { var scroll = jQuery(window).scrollTop(); if (scroll >= 300){ header.addClass('no-transition'); } if (scroll <= 300){ header.removeClass('no-transition'); } if (scroll >= 500) { if(!header.hasClass('navigation-wrap_scroll-on')){ header.addClass("navigation-wrap_scroll-on").hide().slideDown(); } } else { if(header.hasClass('navigation-wrap_scroll-on')){ header.removeClass("navigation-wrap_scroll-on"); } } });*/ var _width = 0; setTimeout(function () { jQuery('.image__grid-item').each(function(){ // width() _width = parseInt(_width + jQuery(this).outerWidth()); }); jQuery('.image__grid-list').css({'width':_width+'px'}); },800); jQuery(window).resize(function (){ var _width = 0; jQuery('.image__grid-item').each(function(){ // width() _width = parseInt(_width + jQuery(this).outerWidth()); }); jQuery('.image__grid-list').css({'width':_width+'px'}); banner_resize(); }); jQuery('.lp-box_lo').click(function (e) { // e.preventDefault(); }); jQuery('.lp-box__number').click(function (e) { e.stopPropagation(); e.preventDefault(); window.location = jQuery(this).data('number'); }) })(jQuery); if(jQuery('.tm-col-7').length > 0 && jQuery('.tm-container').length > 0 ){ var w = parseInt(jQuery('.tm-col-7').width() + jQuery('.tm-container').offset().left +15); jQuery('#testimonial').css({'width': w}); } var __owl = jQuery('.owl-carousel').owlCarousel({ loop:false, items:2, margin:20, stagePadding: 50, // mouseDrag:false, responsive:{ 0:{ items:1, mouseDrag:true, loop:false, }, 480:{ slideBy: 2, stagePadding: 20, items:1, mouseDrag:true, loop:false, touchDrag:true }, 992:{ items:1 }, 1000:{ items:2 } } /*loop:true, autoplay:true, autoplayTimeout:2000, autoplayHoverPause:true*/ }); __owl.on('changed.owl.carousel', function(event) { if( isMobile.any() ){ jQuery('.lp-dots__item').removeClass( 'lp-dots__item_active' ); jQuery('.lp-dots__item').eq(event.item.index).addClass('lp-dots__item_active'); } }); jQuery(window).resize(function(){ __owl.trigger('refresh.owl.carousel'); if(jQuery('.tm-col-7').length > 0 && jQuery('.tm-container').length > 0 ){ var w = parseInt(jQuery('.tm-col-7').width() + jQuery('.tm-container').offset().left +15); jQuery('#testimonial').css({'width': w}); } var ln = jQuery('.owl-dot').length; var html = ''; var active_class = 'lp-dots__item_active'; for(var i = 1 ; i <= ln ; i++){ if(i > 1)active_class=""; html +='
  • '; } jQuery('.lp-dots').html(html); }); /** * Generate custom dots for owl slider * */ var ln = jQuery('.owl-dot').length; var html = ''; var active_class = 'lp-dots__item_active'; for(var i = 1 ; i <= ln ; i++){ if(i > 1)active_class=""; html +='
  • '; } jQuery('.lp-dots').html(html); /** * owl Slider dot click event * */ jQuery(document).ready(function(){ jQuery(document).on('click','.lp-dots__item',function (e) { //e.stopPropagation(); jQuery('.lp-dots__item').removeClass('lp-dots__item_active'); jQuery(this).addClass('lp-dots__item_active'); __owl.trigger('to.owl.carousel', [jQuery(this).index(), 300]); }); jQuery(document).on('click',function(e) { var target = e.target; // console.info(jQuery(target).parents('.menu-right').length); if(jQuery(".navbar-toggle").hasClass('slide-active')) { // Navbar is opened on mobile // console.info('ssss'); if (jQuery(target).parents('.menu-right').length > 0) { } else{ jQuery('body , html').removeClass('noscroll'); jQuery('.navbar-toggle').removeClass('slide-active'); togglemenu(); jQuery('.navbar-toggle i').removeClass('fa-close'); jQuery('.navbar-toggle i').addClass('fa-bars'); } } }); }); /** * Remove Orphan words * */ function resizeText() { jQuery('.lp-btn-responsive span').each(function() { jQuery( this ).fontSizeAdapter({ fontMax: 42, fontMin: 8 }); }); } jQuery(document).ready(function() { /*jQuery('p:not(.form-submit, form p)').html(function(){ // separate the text by spaces var text= jQuery(this).text().split(' '); // drop the last word and store it in a variable var last = text.pop(); // join the text back and if it has more than 1 word add the span tag // to the last word return text.join(" ") + (text.length > 0 ? ' '+last+'': last); });*/ if(jQuery("#sidebar h3.banner-title,#sidebar .banner-content p, .category-blog .post .entry-content p, .single-post .post .entry-content p").length > 0){ jQuery("#sidebar h3.banner-title,#sidebar .banner-content p, .category-blog .post .entry-content p, .single-post .post .entry-content p").html(function(){ // trim space // separate the text by spaces var html= jQuery(this).html().split(' '); // drop the last word and store it in a variable var last = html.pop(); // join the text back and if it has more than 1 word add the span tag // console.info(last); // to the last word return html.join(" ") + (html.length > 0 ? ' '+last+'': last); }); } // var trim = jQuery.trim(jQuery(".single-post .blog-banner__title").text()); jQuery.fn.lastWord = function() { //var text = this.text().trim().split(" "); var text = jQuery(this).html().trim().split(" "); var last = text.pop(); this.html(text.join(" ") + (text.length > 0 ? " " + last + "" : last)); }; jQuery.fn.lastWordindex = function() { var last_anchor = jQuery(this).find("a:last-child"); //console.log("----Start-----"); //console.log(last_anchor); jQuery(this).find("a:last-child").remove(); var target_ele = jQuery(this).html(); //console.log(target_ele); var raw_data = target_ele.split(" "); var data_arr = []; jQuery.each(raw_data, function( index, value ) { if(value){ data_arr.push(value); } }); //console.log(data_arr); var indexoftext = data_arr[data_arr.length-3]; data_arr[data_arr.length-2]=' '+data_arr[data_arr.length-2]; data_arr[data_arr.length-3]=' '+data_arr[data_arr.length-3]; var format_txt=data_arr.join(" ").replace(/\s+ /, ' '); format_txt=format_txt.replace('  ...',' ...'); //console.log(format_txt); jQuery(this).html(format_txt); //console.log("----End-----"); /*var text = jQuery(this).html().split(" 0){ jQuery(".category-blog .post .entry-content p").lastWordindex(); } if(jQuery(".single-post .blog-banner__title, .single-post .post .entry-content header.entry-header h2.entry-title").length > 0){ jQuery(".single-post .blog-banner__title, .single-post .post .entry-content header.entry-header h2.entry-title").lastWord(); } jQuery("#commentform").validate({ submitHandler: function(form) { jQuery(form).submit(); }, rules: { author: { required: true }, comment: { required: true }, email: { required: true, email: true, } } }); jQuery('.comment-tooltip').tooltip({ // html:true }); resizeText(); jQuery(window).resize(function() { jQuery('.lp-btn-responsive, .lp-btn-responsive span').addClass("lp-notransition"); if(this.resizeTO) clearTimeout(this.resizeTO); this.resizeTO = setTimeout(function() { jQuery(this).trigger('windowResize'); }, 800); }); jQuery(window).on('windowResize', function() { resizeText(); window_resize_handler(); jQuery('.lp-btn-responsive, .lp-btn-responsive span').removeClass("lp-notransition"); }); // jQuery("#navigation-header").css('display','block'); jQuery(window).load(function(e){ jQuery("#mask").fadeOut(1100) }); bind_dropdown_event(); navigation_handler(); window_resize_handler(); if (lp_custom.sticky_menu_display != "disable") { if (lp_custom.sticky_menu_display == "all_pages") { navigation_scroll(); } else if (lp_custom.sticky_menu_display == "home") { if (lp_custom.is_home) { navigation_scroll(); } } } newsletter_handler(); var flexsliderOptions = { manualControls: '.flex-manual .switch', nextText: "Next", prevText: "Prev", startAt: 1, slideshow: true, direction: "horizontal", animation: "slide" }; // jQuery('#leadpop_footer').find('a').attr('title', jQuery('title').text()); // jQuery('#leadpop_footer').find('img').attr('alt', jQuery('title').text()); if(jQuery.isFunction('flexslider')){ jQuery('.testimonials-slider').flexslider(flexsliderOptions); } //back-to-top functions jQuery('.back-to-top').on('click', function (event) { event.preventDefault(); event.stopPropagation(); jQuery('html, body').animate({ scrollTop: 0, easing: 'swing' }, 750); }); jQuery(window).on('scroll', function() { if (jQuery(window).scrollTop() > 250) { jQuery('.back-to-top').fadeIn(); }else { jQuery('.back-to-top').fadeOut(); } }); jQuery('img.lp-grid__img').each(function(){ var $img = jQuery(this); var imgID = $img.attr('id'); var imgClass = $img.attr('class'); var imgURL = $img.attr('src'); jQuery.get(imgURL, function(data) { // Get the SVG tag, ignore the rest var $svg = jQuery(data).find('svg'); // Add replaced image's ID to the new SVG if(typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); } // Add replaced image's classes to the new SVG if(typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass+' replaced-svg'); } // Remove any invalid XML tags as per http://validator.w3.org $svg = $svg.removeAttr('xmlns:a'); // Replace image with new SVG $img.replaceWith($svg); }, 'xml'); // var title = $img.find('title').text("test title!"); }); setTimeout(function () { jQuery('.lp-grid__inner').each(function(){ jQuery(this).find('title').text(jQuery(this).find('.lp-grid__title').text()); }); },1000) jQuery('.link_popup a, a.footer__bottom_link').click(function (e) { e.preventDefault(); window.open(jQuery(this).attr('href'), '', 'resizable=no,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=yes,dependent=no,width=800,height=800'); return false; }); var increment = 0; jQuery('.owl-item').click(function () { if(jQuery(window).width() < 769){return;} jQuery(this).addClass('lp-stop'); var _self = jQuery(this); var vp = jQuery('.owl-stage-outer').width(); var w = 0; setTimeout(function () { jQuery('.owl-item').each(function () { w = parseInt(w + jQuery(this).width()); console.info('w:'+w); console.info('vp:'+vp); if(jQuery(this).hasClass('lp-stop')){ if(vp < w){ increment++; __owl.trigger('next.owl.carousel'); if(increment == 2 || jQuery(window).width() < 1000){ increment = 0; change_owl_dot(); } } return false; } }); jQuery('.owl-item').removeClass('lp-stop'); },200); // console.info(jQuery('.owl-stage-outer').width()) }) }); function change_owl_dot() { jQuery('.lp-dots__item.lp-dots__item_active').removeClass('lp-dots__item_active').next('.lp-dots__item').addClass('lp-dots__item_active'); } /*jQuery('.navbar-toggle').click(function(e){ e.stopPropagation(); if(jQuery(this).hasClass('slide-active')){ jQuery('body , html').removeClass('noscroll'); jQuery(this).removeClass('slide-active'); jQuery('.navbar-header').css({'margin-left': '0'}); jQuery('.navbar .navbar-collapse').css({'right':'-100%'}); /!* jQuery('.navbar .lp-nav__right , .inner-header__main .lp-nav__right').delay('2000').css({'opacity':'1','transition': 'all 2.5s'}); *!/ jQuery('.lp-navbar-toggle i').removeClass('fa-close'); jQuery('.lp-navbar-toggle i').addClass('fa-bars'); }else{ // outside_close_menu(); jQuery('body , html').addClass('noscroll'); /!* jQuery('.navbar').css({'opacity':'0','transition': 'all .1s'});*!/ var mrg = jQuery('.menu-container').width(); var mrg = mrg; jQuery(this).addClass('slide-active'); jQuery('.navbar-header').css({'margin-left': '-'+mrg+'px'}); jQuery('.navbar .navbar-collapse').css({'right':'0'}); jQuery('.lp-navbar-toggle i').removeClass('fa-bars'); jQuery('.lp-navbar-toggle i').addClass('fa-close'); } });*/ function presize($obj, w, h) { //console.count(); var nw = jQuery('body').find($obj).width(), nh = jQuery('body').find($obj).height(); /*console.info($obj); console.info('width:'+nw); console.info('height:'+nh);*/ if ((nw > w) && w > 0) { nw = w; nh = (w / jQuery('body').find($obj).width()) * jQuery('body').find($obj).height(); } if ((nh > h) && h > 0) { nh = h; nw = (h / jQuery('body').find($obj).height()) * jQuery('body').find($obj).width(); } xscale = jQuery('body').find($obj).width() / nw; yscale = jQuery('body').find($obj).height() / nh; jQuery('body').find($obj).width(nw).height(nh); if(nh > 50 && jQuery(window).height() > 1100){ jQuery('.navbar__list').height(nh); } } function animate_navigation(_this){ var navigationwrapper = '.navbar-header'; var slidewidth = '0'; var menu_dalta = '-50%'; if(_this.hasClass('slide-active')){ // remove it _this.removeClass('slide-active'); jQuery('.navbar-toggle i').removeClass('fa-close'); jQuery('.navbar-toggle i').addClass('fa-bars'); }else{ _this.addClass('slide-active'); jQuery('.navbar-toggle i').removeClass('fa-bars'); jQuery('.navbar-toggle i').addClass('fa-close'); menu_dalta = '0'; slidewidth = '50%'; } jQuery('.navbar-collapse').css({ right: menu_dalta }); jQuery(navigationwrapper).css({ right: slidewidth }); jQuery('body , html').toggleClass('noscroll'); } function navigation_handler() { // var toggler = '.navbar-toggle'; // jQuery("#navigation-header").on("click", toggler, function(e) { // e.preventDefault(); // // }); /*jQuery('.navbar-toggle').click(function (e) { e.stopPropagation(); animate_navigation(jQuery(this)); });*/ } /*jQuery(document).click(function(e) { var target = e.target; if(jQuery(".navbar-toggle").hasClass('slide-active')) { // Navbar is opened on mobile if (jQuery(target).parents('.navbar-collapse').length > 0) { } else{ jQuery('.navbar-header').css({'right': '0'}); jQuery('.navbar-collapse').css({'right': '-65%'}); jQuery('#navigation-header').find('.slide-active').removeClass('slide-active'); jQuery('body , html').removeClass('noscroll'); jQuery('.navbar-toggle i').removeClass('fa-close'); jQuery('.navbar-toggle i').addClass('fa-bars'); } } });*/ var w =jQuery(window).width(); function window_resize_handler() { if (jQuery(window).width() > 1199 && jQuery('.navbar-toggle').is(':hidden')) { jQuery('body').removeClass('mobile'); jQuery('.navbar-collapse').removeAttr('style'); } else { jQuery('body').addClass('mobile'); jQuery('.navbar-collapse').css('min-height', jQuery(window).height()); } } function bind_dropdown_event() { if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { jQuery(".menu-container .dropdown").click(function() { if(jQuery(this).hasClass('open')){ _this = jQuery(this); jQuery(this).find('.dropdown-menu').stop().slideUp(300 , function(){ _this.toggleClass('open'); }); }else{ jQuery('.dropdown-menu').slideUp('fast'); jQuery('.menu-container .dropdown').delay(1500).removeClass('open'); jQuery(this).toggleClass('open'); jQuery(this).find('.dropdown-menu').stop().slideDown(); } }); }else{ jQuery(".menu-container .dropdown").hover( function() { jQuery('.dropdown-menu', this).stop(true, true).slideDown("fast"); jQuery(this).toggleClass('open'); }, function() { jQuery('.dropdown-menu', this).stop(true, true).slideUp("fast"); jQuery(this).toggleClass('open'); } ); } } var menuTrigger = false; var menuTriggerOld = false; function navigation_scroll() { jQuery(window).on('scroll', function() { var scrollTop = jQuery(this).scrollTop(); var _top = 500; if (lp_custom.sticky_menu_position != undefined) { _top = lp_custom.sticky_menu_position; } if (scrollTop >= _top) { menuTrigger = true; } else { menuTrigger = false; } if (menuTrigger != menuTriggerOld) { if (menuTrigger) { stickMenu(); } else { unstickMenu(); } menuTriggerOld = menuTrigger; } }); } function stickMenu() { var header = jQuery(".navigation-wrap"); if (header.data('sticky') != false){ var __ww = jQuery('body').width(); var _custom_w = 120; if(__ww < 1100){ _custom_w = 150; } // presize('.navbar-brand_sm .micro-logo' , _custom_w , 70); header.addClass('no-transition'); if(!header.hasClass('navigation-wrap_scroll-on')){ header.addClass("navigation-wrap_scroll-on").hide().slideDown('fast'); } }else{ var __ww = jQuery('body').width(); var _custom_w = 120; if(__ww < 1100){ _custom_w = 150; } // presize('.navbar-brand_sm .micro-logo' , _custom_w , 70); jQuery('.lp_main_header_sticky').show(); jQuery('.lp_main_header_sticky').find('.navigation-wrap').addClass('no-transition'); if (!jQuery('.lp_main_header_sticky').find('.navigation-wrap').hasClass('navigation-wrap_scroll-on')) { jQuery('.lp_main_header_sticky').find('.navigation-wrap').addClass("navigation-wrap_scroll-on").hide().slideDown(); } } /*jQuery(window).scroll(function() { var scroll = jQuery(window).scrollTop(); if (scroll >= 300){ header.addClass('no-transition'); } if (scroll <= 300){ header.removeClass('no-transition'); } if (scroll >= 500) { if(!header.hasClass('navigation-wrap_scroll-on')){ header.addClass("navigation-wrap_scroll-on").hide().slideDown(); } } else { if(header.hasClass('navigation-wrap_scroll-on')){ header.removeClass("navigation-wrap_scroll-on"); } } });*/ } function unstickMenu() { var header = jQuery(".navigation-wrap"); if (header.data('sticky') != false) { header.removeClass('no-transition'); if(header.hasClass('navigation-wrap_scroll-on')){ header.removeClass("navigation-wrap_scroll-on").hide().slideDown(); } }else{ jQuery('.lp_main_header_sticky').find('.navigation-wrap').removeClass('no-transition'); if (jQuery('.lp_main_header_sticky').find('.navigation-wrap').hasClass('navigation-wrap_scroll-on')) { jQuery('.lp_main_header_sticky').find('.navigation-wrap').removeClass("navigation-wrap_scroll-on"); jQuery('.lp_main_header_sticky').hide(); } } /*jQuery(window).scroll(function() { var scroll = jQuery(window).scrollTop(); if (scroll >= 300){ header.removeClass('no-transition'); } if (scroll <= 300){ header.removeClass('no-transition'); } if (scroll >= 500) { if(!header.hasClass('navigation-wrap_scroll-on')){ header.removeClass("navigation-wrap_scroll-on").hide().slideDown(); } } /!*else { if(header.hasClass('navigation-wrap_scroll-on')){ header.removeClass("navigation-wrap_scroll-on"); } }*!/ });*/ } function newsletter_handler() { jQuery('[id^=subscribe]').submit(function() { $response = jQuery(this).find('[id^=response]'); $response.html( 'Adding email address...'); var name = jQuery(this).find('.NewsletterName').val().split(' '); var provider = jQuery(this).find('.provider').val() || 'mailchimp'; var apiKey = jQuery(this).find('.apiKey').val() || ''; var listId = jQuery(this).find('.listId').val() || ''; var dopt = jQuery(this).find('.dopt').val() || ''; var fname = name[0] || ''; var lname = name[1] || ''; var templateUrl = locale.templateUrl; // Prepare query string and send AJAX request jQuery.ajax({ url: templateUrl + '/includes/mailing-list/mailing-list.php', data: 'ajax=true&email=' + escape(jQuery(this).find( '.NewsletterEmail') .val()) + '&fname=' + fname + '&lname=' + lname + '&akey=' + apiKey + '&lid=' + listId + '&dopt=' + dopt + '&provider=' + provider, success: function(msg) { if (msg.indexOf("Success") != -1) { $response.html( 'Success! You are now subscribed to our newsletter!' ); } else { $response.html('' + msg + ''); } } }); return false; }); if (jQuery('.cycle').length > 0 && lp_custom.disable_home_cta != 1) { jQuery('.cycle').each(function(index, el) { var _labels = jQuery(el).prev('div'); _labels = _labels.text().split(','); var counter = 0; setInterval(function() { // var arr = ['FHA Loans', 'Refinancing', 'HARP Loans', // 'Home Loans', // 'Reverse Mtgs' // ]; var target = jQuery(el).find('b'); counter = (counter == (_labels.length - 1)) ? 0 : counter += 1; target.animate({ top: '-170px' }, function() { target.html(_labels[counter]).animate({ top: '0' }); }); }, 4000); }); } } var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; jQuery(window).resize(function (e) { resizeText(); var __ww = jQuery('body').width(); var _custom_w = 220; if(__ww < 1150 && __ww > 1050){ _custom_w = 190; } if(__ww < 1050 && __ww > 470){ _custom_w = 160; } if(__ww < 470){ _custom_w = 130; } // setTimeout(function () { // presize('.navbar-brand .logo' , _custom_w , 70); // presize('.navbar-brand .micro-logo' , _custom_w , 70); // presize('.lp_main_header_sticky .micro-logo' , 150 , 70); // },150); }); // requestAnimationFrame polyfill starts here (function () { var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback, element) { var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); var id = window.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { clearTimeout(id); }; }()); // requestAnimationFrame polyfill ends here jQuery(document).ready(function (){ var $ = jQuery; var regex = /lpSupercalcHeight=(\d+)/; var $iframe = $('.cal_iframe.lp-supercalc'); if( ! $iframe.length ){ return; } try { var iframe = $iframe[0]; // return if postMessage API is not supported if( !( iframe.contentWindow && iframe.contentWindow.postMessage ) ){ return; } } catch (e){ return; } $('body').addClass('supercalc-loaded'); var protocolEstablished = false; window.addEventListener('message', function (e){ var msg = e.data; var height = msg.match(regex); if( height ){ height = parseInt( height[1] ); $iframe.height(height); if( !protocolEstablished ){ requestAnimationFrame( function (){ iframe.contentWindow.postMessage( 'lpSupercalcHeightReceived' , '*'); }); } } else if ( msg == 'lpSupercalcHeightProtocolEstablished' ){ protocolEstablished = true; } }); }); /* ------------------- ADA position fixed! ------------------- */ jQuery(document).ready(function () { var $ = jQuery; var tries = 5; var left_align_iframe = function (){ var $iframe = jQuery('.userway_iframe'); var style = $iframe.attr('style'); if( tries && (!$iframe.length || style.indexOf('max-width: 360px !important;') < 0) ){ tries--; setTimeout( left_align_iframe, 1000 ); } $iframe.attr('style', style + '; max-width: 360px !important;max-height: 600px !important;position: fixed;top: auto !important;bottom: 36px;'); } $(window).on('load', function(){ setTimeout( left_align_iframe , 1000); }); });