var clixly = { /* ** mobile menu function **/ mobileMenu: function () { jQuery('.hamburger').click(function (e) { e.preventDefault(); jQuery('body').toggleClass('menu-active'); if(jQuery('.menu-holder__area').hasClass('active')) { setTimeout(function () { jQuery('.menu-holder__area').removeClass('active'); }, 400); } jQuery('.menu-holder__area').addClass('active'); }); }, /* ** outside click mobile menu close function **/ outSideClickMobileMenuClose: function () { jQuery(document).click(function(e) { var target = e.target; if(jQuery("body").hasClass('menu-active')) { if (jQuery(target).hasClass('hamburger') || jQuery(target).parent().hasClass('dropdown')) { } else{ jQuery('body').removeClass('menu-active'); } } }); }, /* ** top-bar close function **/ topBarClose: function () { jQuery('.top-bar__close').click(function(e) { e.preventDefault(); jQuery('.top-bar').slideUp(function() { jQuery('.top-bar-arrow').slideDown('fast'); }); jQuery('body').removeClass('top-bar-active'); }) }, /* ** top-bar arrow close function **/ topBarArrowClose: function () { jQuery('.top-bar-arrow').click(function(e) { e.preventDefault(); jQuery('.top-bar-arrow').slideUp('fast'); jQuery('.top-bar').slideDown('fast'); jQuery('body').addClass('top-bar-active'); }) }, /* ** on page scroll function **/ onPageScroll:function() { jQuery('.smooth-scroll').on('click',function (e) { e.preventDefault(); var _offset = jQuery('.top-bar').height() + jQuery('.header').height(); if(jQuery(window).width() >= 992) { if(jQuery(this).attr('href') == '#works')_offset = _offset - 70; if(jQuery(this).attr('href') == '#pricing')_offset = _offset - 150; if(jQuery(this).attr('href') == '#faq')_offset = _offset - 250; if(jQuery(this).attr('href') == '#reviews')_offset = _offset - 150; } else { if(jQuery(this).attr('href') == '#works')_offset = _offset - 40; if(jQuery(this).attr('href') == '#pricing')_offset = _offset - 80; if(jQuery(this).attr('href') == '#faq')_offset = _offset - 150; if(jQuery(this).attr('href') == '#reviews')_offset = _offset - 100; } var target = this.hash, $target = jQuery(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top -_offset }, 1500, 'swing'); jQuery('body').removeClass('menu-active'); }); }, /* ** sticky header function **/ stickyHeader: function () { jQuery('#wrapper' ).waypoint(function(direction){ var _sticky_header = jQuery('.header'); if (direction == "down") { setTimeout(function () { _sticky_header.css({ 'position': 'fixed', 'background-color': 'transparent' }); _sticky_header.addClass('header_sticky'); jQuery('body').removeClass('menu-active'); _sticky_header.hide().slideDown('fast'); },200); } else { _sticky_header.css({ 'position': 'absolute', 'background-color': 'transparent' }); _sticky_header.removeClass('header_sticky'); } },{ offset: '-150' }); }, /* ** accordion function **/ accordion: function() { jQuery('.accordion__opener').click(function (e) { e.preventDefault(); var _self = jQuery(this); if(_self.hasClass('active')) { _self.removeClass('active'); _self.next('.accordion__slide').slideUp(); } else { var $currentActive = _self.parents('.accordion').find('.accordion__opener.active'); $currentActive.removeClass('active'); $currentActive.siblings('.accordion__slide').slideUp(); _self.addClass('active'); _self.next('.accordion__slide').slideDown(); } }); }, /* ** initSlickCarousel function **/ initSlickCarousel: function() { jQuery('.slick-slider').slick({ slidesToScroll: 1, rows: 0, slidesToShow: 3, arrows: false, dots: true, dotsClass: 'slick-dots', autoplay: false, responsive: [{ breakpoint: 768, settings: { slidesToScroll: 1, slidesToShow: 1 } }, { breakpoint: 1200, settings: { slidesToScroll: 1, slidesToShow: 2 } }] }); }, /** ** mCustomScrollbar function **/ mCustomScrollbar: function() { jQuery(".scroll-bar").mCustomScrollbar({ scrollButtons:{ scrollAmount: 300 }, scrollbarPosition:"outside", scrollTo: 0, }); }, /* ** resizeEffect function **/ resizeEffect: function () { jQuery(window).resize(function () { if(jQuery(window).width() > 991) { jQuery('body').removeClass('menu-active'); } }); }, initBodyCustomScroll: function () { if(location.search.indexOf('mcs=1') > -1){ $('html').addClass('mcustom-scroll') $('body') .mCustomScrollbar({ axis: 'y' }) $('.btn').on('click', function(e) { e.preventDefault() window.parent.postMessage('lpStickyCtaClicked', '*') }) } }, /* ** init function **/ init: function () { if(location.search.indexOf('postHeight=1') > -1 && window.postMessage){ function postDocumentHeight() { window.parent.postMessage('lpWindowHeight=' + $('#wrapper').height(), '*') } $(document).ready(postDocumentHeight) $(window).on('load resize', postDocumentHeight) } clixly.initBodyCustomScroll() clixly.mobileMenu(); clixly.outSideClickMobileMenuClose(); clixly.topBarClose(); clixly.topBarArrowClose(); clixly.stickyHeader(); clixly.onPageScroll(); clixly.accordion(); clixly.initSlickCarousel(); clixly.mCustomScrollbar(); clixly.resizeEffect(); 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(window).on('load', function() { setTimeout(function() { jQuery('.mCustomScrollbar').attr('disabled', false); }, 500); }); }, }; jQuery(document).ready(function() { clixly.init(); });