;(function ($, window, document, undefined) { 'use strict'; /*============================*/ /* 01 - VARIABLES */ /*============================*/ var swipers = [] , winW, winH, winScr, _isresponsive, smPoint = 768 , mdPoint = 992 , lgPoint = 1200 , addPoint = 1600 , _ismobile = navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i); /*========================*/ /* 02 - PAGE CALCULATIONS */ /*========================*/ function pageCalculations() { winW = $(window).width(); winH = $(window).height(); } /*=================================*/ /* 03 - FUNCTION ON DOCUMENT READY */ /*=================================*/ pageCalculations(); /*============================*/ /* 04 - FUNCTION ON PAGE LOAD */ /*============================*/ $(window).on('load', function () { $('body').addClass('loaded').find('.preloader-wrap').addClass('loaded'); wpc_add_img_bg('.s-img-switch'); }); /*==============================*/ /* 05 - FUNCTION ON PAGE RESIZE */ /*==============================*/ function resizeCall() { pageCalculations(); } if (!_ismobile) { $(window).resize(function () { resizeCall(); }); } else { window.addEventListener("orientationchange", function () { resizeCall(); }, false); } /*=====================*/ /* 06 - SWIPER SLIDERS */ /*=====================*/ /***********************************/ /* BACKGROUND*/ /**********************************/ // with out img height function wpc_add_img_bg( img_sel, parent_sel){ if (!img_sel) { console.info('no img selector'); return false; } var $parent, $imgDataHidden, _this; $(img_sel).each(function(){ _this = $(this); $imgDataHidden = _this.data('s-hidden'); $parent = _this.closest( parent_sel ); $parent = $parent.length ? $parent : _this.parent(); $parent.css( 'background-image' , 'url(' + this.src + ')' ).addClass('s-back-switch'); if ($imgDataHidden) { _this.css('visibility', 'hidden'); } else { _this.hide(); } }); } $('.landing-banner').on('click', 'a[href*="#"]:not([href="#"])', function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); })(jQuery, window, document);