var custom = { /* ** add class on scroll function **/ AddClassScroll: function() { if (jQuery('body').hasClass('enable-sticky-header')) { jQuery(window).scroll(function () { var scroll = jQuery(window).scrollTop(); if (scroll >= 1) { jQuery("body").addClass("fixed-header"); } else { jQuery("body").removeClass("fixed-header"); } }); } }, /* ** Menu function **/ Mobile_Menu: function () { jQuery('.nav-open').click(function (e) { e.preventDefault(); if(jQuery('html').hasClass('nav-active')) { jQuery('html').removeClass('nav-active'); } else { jQuery('html').addClass('nav-active'); } setTimeout(function () { custom.NiceScroll(); }, 600); }); jQuery('.nav-close').click(function (e) { e.preventDefault(); if(jQuery('html').hasClass('nav-active')) { jQuery('html').removeClass('nav-active'); } }); }, /* ** Resize_Effect function **/ Resize_Effect: function () { jQuery(window).resize(function () { jQuery('body').addClass('resize-active'); if(jQuery(window).width() > 991) { jQuery('html').removeClass('nav-active'); jQuery('.menu-dropdown').hide(); jQuery('.dropdown-open').removeClass('open'); } }); }, /* ** SlickCarousel Function **/ Slick_Slider: function () { jQuery('.sectionToolsSlider').slick({ slidesToScroll: 1, rows: 0, slidesToShow: 1, asNavFor: '.sectionToolsNav', prevArrow: '.section-tools .slick-prev-custom', nextArrow: '.section-tools .slick-next-custom', dots: false, focusOnSelect: false, infinite: true, responsive: [ { breakpoint: 767, settings: { fade: true, } }, ] }); jQuery('.sectionToolsNav').slick({ slidesToScroll: 1, rows: 0, slidesToShow:1, asNavFor: '.sectionToolsSlider', arrows: false, dots: false, variableWidth: true, focusOnSelect: true, infinite: true, }); jQuery('.testimonialsSlider').slick({ slidesToScroll: 1, rows: 0, slidesToShow: 1, arrows: false, dots: true, infinite: true, autoplay: true, autoplaySpeed: 4000 }); jQuery('.testimonialsSliderSingle').slick({ slidesToScroll: 1, rows: 0, slidesToShow: 1, arrows: false, dots: true, focusOnSelect: false, infinite: true, autoplay: true, autoplaySpeed: 4000 }); }, /* ** Nice Scroll Function **/ NiceScroll: function () { jQuery('.main-nav').niceScroll(".nav-drop",{ cursorcolor:"rgba(255,255,255,0.35)", cursorwidth: "10px", autohidemode: false, cursorborder: "1px solid rgba(255,255,255,0.35)", bouncescroll: false, sensitiverail: false, }); }, /* ** SuperCalc Functions **/ superCalcShareEvent: function(){ window.addEventListener('message', function(e){ var data = e.data; if(data == 'superCalcShareEvent'){ jQuery("html, body").animate({ scrollTop: 0 }, "slow"); } }); }, supercalcAutoResizer : 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; } }); }, /* ** Tabs **/ tabs: function () { jQuery('.blog-tabs a').click(function (e) { e.preventDefault(); if (!jQuery(this).hasClass("selected")) { jQuery('.blog-tabs a').removeClass("selected"); jQuery('.tab-block').hide().removeClass('tab-active'); jQuery('.tab-block-' + jQuery(this).attr("class")).fadeIn(300).addClass('tab-active'); jQuery(this).addClass("selected"); } }); }, /* ** Pre-Loader **/ preLoader:function(){ jQuery("#mask").fadeOut(1100); }, /* ** init Function **/ init: function() { custom.AddClassScroll(); custom.Mobile_Menu(); custom.Resize_Effect(); custom.Slick_Slider(); custom.NiceScroll(); custom.superCalcShareEvent(); custom.supercalcAutoResizer(); custom.tabs(); custom.preLoader(); // jQuery(document).click(function(e) { // var target = e.target; // if(jQuery('html').hasClass('nav-active')) { // if (!jQuery(target).hasClass('nav-open') && !jQuery(target).parents('.main-nav').length) { // jQuery('html').removeClass('nav-active'); // } // } // }) jQuery("a[href='#top']").click(function() { jQuery("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); var webp = new Image(); webp.onerror = function(){ jQuery('body').removeClass('webp') jQuery('body').addClass('no-webp') }; webp.onload = function(){ jQuery('body').removeClass('no-webp') jQuery('body').addClass('webp') }; webp.src = 'data:pimage/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoBAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA=='; }, }; jQuery(document).ready(function() { custom.init(); var $ = jQuery; var tries = 5; var left_align_iframe = function (){ var $iframe = jQuery('.uwif.userway_p1'); 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: 100% !important;max-height: 650px !important;position: fixed;top: auto !important;bottom: 45px;'); } $(window).on('load', function(){ setTimeout( left_align_iframe , 1000); }); });