(function($){ "use strict"; $(window).on('load', function() { // Preloader $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); initTwittslider(); initOwlCarousel(); initCounters(); $(window).trigger("resize"); $.stellar({ horizontalScrolling: false, hideDistantElements: false }); }); // Init initMasonry(); squareDiv(); $(window).resize(function(){ container_full_height_init(); $.stellar('refresh'); megaMenu(); megaMenuWide(); squareDiv(); if (minWidth(992)) { $('.navigation').removeClass('sticky'); $('.local-scroll.desktop-offset-0').localScroll({offset: {top: -60},duration: 1500,easing:'easeInOutExpo'}); $('.local-scroll.mobile-offset-0').localScroll({offset: {top: 0},duration: 1500,easing:'easeInOutExpo'}); } else { $('.local-scroll.mobile-offset-0').localScroll({offset: {top: -60},duration: 1500,easing:'easeInOutExpo'}); $('.local-scroll.desktop-offset-0').localScroll({offset: {top: 0},duration: 1500,easing:'easeInOutExpo'}); } }); /* Detect Browser Size -------------------------------------------------------*/ var minWidth; if (Modernizr.mq('(min-width: 0px)')) { // Browsers that support media queries minWidth = function (width) { return Modernizr.mq('(min-width: ' + width + 'px)'); }; } else { // Fallback for browsers that does not support media queries minWidth = function (width) { return $(window).width() >= width; }; } /* Sticky Navigation -------------------------------------------------------*/ $(window).scroll(function(){ scrollToTop(); var windowWidth = $(window).width(); var $stickyNav = $('#sticky-nav'); var $navbarFixedTop = $('.navbar-fixed-top'); if ($(window).scrollTop() > 80 & minWidth(992)) { $stickyNav.addClass("sticky"); } else { $stickyNav.removeClass("sticky"); } if ($(window).scrollTop() > 200 & minWidth(992)) { $stickyNav.addClass("offset"); } else { $stickyNav.removeClass("offset"); } if ($(window).scrollTop() > 50 & minWidth(992)) { $stickyNav.addClass("scrolling"); } else { $stickyNav.removeClass("scrolling"); } if ($(window).scrollTop() > 80 ){ $navbarFixedTop.addClass("sticky"); } else { $navbarFixedTop.removeClass("sticky"); } if ($(window).scrollTop() ){ $(".sidenav").removeClass('opened'); $('.main-wrapper').removeClass('sidenav-opened'); $('#nav-icon').removeClass('open'); } else { return false; } }); /* Onepage Nav -------------------------------------------------------*/ $('#onepage-nav').on('click', 'li > a', function() { $(".navbar-collapse").collapse('hide'); }); // Smooth Scroll Navigation $('.local-scroll').localScroll({offset: {top: -60},duration: 1500,easing:'easeInOutExpo'}); $('.local-scroll-no-offset').localScroll({offset: {top: 0},duration: 1500,easing:'easeInOutExpo'}); /* Full screen Navigation -------------------------------------------------------*/ $('#nav-icon-trigger-2').on("click", function(e){ e.preventDefault(); $('#nav-icon, #nav-overlay').toggleClass('open'); $('body').toggleClass('fs-open'); $(function(){ var delay = 0 $('.overlay-menu > ul > li').each(function(){ $(this).css({animationDelay: delay+'s'}) delay += 0.1 }) }) }); /* Sidenav -------------------------------------------------------*/ var $mainWrapper = $('.main-wrapper'); var $sidenav = $(".sidenav"); $("#nav-icon-trigger, #sidenav-close").on('click', function(e) { e.preventDefault(); e.stopPropagation(); $sidenav.toggleClass('opened'); $mainWrapper.toggleClass('sidenav-opened'); }); $mainWrapper.on('click',function() { $(this).removeClass('sidenav-opened'); $sidenav.removeClass('opened'); }); /* Dropdown Navigation -------------------------------------------------------*/ var $dropdownTrigger = $('.dropdown-trigger'); $dropdownTrigger.on('click', function() { if ($(this).hasClass("active")) { $(this).removeClass("active"); } else { $(this).addClass("active"); } }); /* Search -------------------------------------------------------*/ var $searchWrap = $('.search-wrap'); var $navSearch = $('.nav-search'); var $searchClose = $('#search-close'); $('.search-trigger').on('click',function(e){ e.preventDefault(); $searchWrap.animate({opacity: 'toggle'},500); $navSearch.add($searchClose).addClass("open"); }); $('.search-close').on('click',function(e){ e.preventDefault(); $searchWrap.animate({opacity: 'toggle'},500); $navSearch.add($searchClose).removeClass("open"); }); function closeSearch(){ $searchWrap.fadeOut(200); $navSearch.add($searchClose).removeClass("open"); } $(document.body).on('click',function(e) { closeSearch(); }); $(".search-trigger, .main-search-input").on('click',function(e) { e.stopPropagation(); }); /* Mobile Detect -------------------------------------------------------*/ if (/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera)) { $("html").addClass("mobile"); $('.dropdown-toggle').attr('data-toggle', 'dropdown'); } else { $("html").removeClass("mobile"); } /* IE Detect -------------------------------------------------------*/ if(Function('/*@cc_on return document.documentMode===10@*/')()){ $("html").addClass("ie"); } /* Mega Menu -------------------------------------------------------*/ function megaMenu(){ $('.megamenu').each(function () { $(this).css('width', $('.container').width()); var offset = $(this).closest('.dropdown').offset(); offset = offset.left; var containerOffset = $(window).width() - $('.container').outerWidth(); containerOffset = containerOffset /2; offset = offset - containerOffset - 15; $(this).css('left', -offset); }); } function megaMenuWide(){ $('.megamenu-wide').each(function () { $(this).css('width', $(window).outerWidth()); var offset = $(this).closest('.dropdown').offset(); offset = offset.left; var containerOffset = $(window).width() - $(window).outerWidth(); containerOffset = containerOffset /2; offset = offset - containerOffset - 0; $(this).css('left', -offset); }); } /* Counters -------------------------------------------------------*/ function initCounters() { $('.statistic').appear(function() { $('.statistic-timer').countTo({ speed: 4000, refreshInterval: 60, formatter: function (value, options) { return value.toFixed(options.decimals); } }); }); } /* Twitter Slider -------------------------------------------------------*/ function initTwittslider(){ $('.twitter-slider #tweets ul').addClass('owl-carousel owl-theme light-arrows text-center').attr('id', 'owl-single'); } /* Owl Carousel -------------------------------------------------------*/ function initOwlCarousel(){ (function($){ "use strict"; /* Testimonials -------------------------------------------------------*/ $("#owl-testimonials").owlCarousel({ navigation: false, navigationText: ["", ""], autoHeight: true, slideSpeed: 300, pagination: true, paginationSpeed: 400, singleItem: true, stopOnHover: true }) // 2 Boxes $("#owl-testimonials-boxes-2").owlCarousel({ navigation: false, slideSpeed: 300, pagination: true, paginationSpeed: 400, stopOnHover: true, itemsCustom: [ [0, 1], [450, 1], [700, 2], [1200, 2] ], }) /* Partners Logo -------------------------------------------------------*/ $("#owl-partners").owlCarousel({ autoPlay: 3000, pagination: true,loop: true, itemsCustom: [ [0, 2], [370, 3], [550, 4], [700, 5], [1000, 6] ], }) /* 3 Items -------------------------------------------------------*/ $("#owl-3-items").owlCarousel({ // autoPlay: 3000, pagination: true, navigation: false, navigationText: ["", ""], itemsCustom: [ [0, 1], [370, 1], [550, 2], [700, 3], [1000, 3] ], }) /* 3 Items -------------------------------------------------------*/ var owl3ItemsArrows = $("#owl-3-items-arrows").owlCarousel({ pagination: false, navigation: false, navigationText: ["", ""], itemsCustom: [ [0, 1], [370, 1], [550, 2], [700, 3], [1000, 3] ], }) // Custom Navigation Events $(".next").on('click',function(){ owl3ItemsArrows.trigger('owl.next'); }) $(".prev").on('click',function(){ owl3ItemsArrows.trigger('owl.prev'); }); /* Shop Items Slider -------------------------------------------------------*/ $("#owl-shop-items-slider").owlCarousel({ // autoPlay: 2500, pagination: false, navigation: true, navigationText: ["", ""], itemsCustom: [ [0, 1], [370, 2], [550, 3], [700, 4], [1000, 4] ], }) /* Single Image -------------------------------------------------------*/ $("#owl-single").owlCarousel({ navigation: false, pagination: true, slideSpeed: 300, paginationSpeed: 400, singleItem: true, navigationText: ["", ""] }) })(jQuery); }; /* Blog Masonry / FlexSlider -------------------------------------------------------*/ $('#flexslider').flexslider({ animation: "slide", controlNav: true, directionNav: false, touch: true, slideshow: false, prevText: [""], nextText: [""], start: function(){ var $container = $('.masonry'); $container.imagesLoaded( function() { $container.isotope({ itemSelector: '.masonry-item', layoutMode: 'masonry' }); }); } }); /* Flickity Slider -------------------------------------------------------*/ var $flickitySliderWrap = $('.flickity-slider-wrap'); if ($flickitySliderWrap.data('autoplay')) { var dataAutoPlay = true; } else { var dataAutoPlay = false; } if ($flickitySliderWrap.data('arrows')) { var dataArrows = true; } else { var dataArrows = false; } if ($flickitySliderWrap.data('slidedots')) { var dataSlideDots = true; } else { var dataSlideDots = false; } // Featured Works $('#works-slider').flickity({ cellAlign: 'left', contain: true, wrapAround: true, autoPlay: dataAutoPlay, prevNextButtons: dataArrows, percentPosition: true, imagesLoaded: true, lazyLoad: 1, pageDots: dataSlideDots, draggable: true, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 15,50 L 60,95 L 65,90 L 25,50 L 65,10 L 60,5 Z' }); // Photography slider $('#photography-slider').flickity({ cellAlign: 'center', wrapAround: true, autoPlay: dataAutoPlay, prevNextButtons: dataArrows, percentPosition: false, imagesLoaded: true, lazyLoad: 1, pageDots: dataSlideDots, draggable: true, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 15,50 L 60,95 L 65,90 L 25,50 L 65,10 L 60,5 Z' }); // Showcases slider $('#showcases-slider').flickity({ cellAlign: 'center', wrapAround: true, autoPlay: dataAutoPlay, prevNextButtons: dataArrows, percentPosition: false, imagesLoaded: true, lazyLoad: 1, pageDots: dataSlideDots, draggable: true, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 15,50 L 60,95 L 65,90 L 25,50 L 65,10 L 60,5 Z' }); // Featured Works $('#apps-slider').flickity({ cellAlign: 'left', groupCells: true, contain: true, wrapAround: true, autoPlay: dataAutoPlay, prevNextButtons: dataArrows, percentPosition: true, imagesLoaded: true, lazyLoad: 1, pageDots: dataSlideDots, draggable: true, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 15,50 L 60,95 L 65,90 L 25,50 L 65,10 L 60,5 Z' }); // main large image (shop product) var $gallery = $('#gallery-main').flickity({ cellAlign: 'center', contain: true, wrapAround: true, autoPlay: false, prevNextButtons: true, percentPosition: true, imagesLoaded: true, lazyLoad: 1, pageDots: false, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 10,50 L 60,100 L 65,95 L 20,50 L 65,5 L 60,0 Z' }); // thumbs $('.gallery-thumbs').flickity({ asNavFor: '#gallery-main', contain: true, cellAlign: 'left', wrapAround: false, autoPlay: false, prevNextButtons: false, percentPosition: true, imagesLoaded: true, pageDots: false, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false }); // Single item $('#slider-single').flickity({ cellAlign: 'left', contain: true, wrapAround: true, autoPlay: dataAutoPlay, prevNextButtons: dataArrows, percentPosition: true, imagesLoaded: true, lazyLoad: 1, pageDots: dataSlideDots, selectedAttraction : 0.1, friction: 0.6, rightToLeft: false, arrowShape: 'M 10,50 L 60,100 L 65,100 L 15,50 L 65,0 L 60,0 Z' }); var $gallery = $('.mfp-hover'); $gallery.on( 'dragStart.flickity', function( event, pointer ) { $(this).addClass('is-dragging'); }) $gallery.on( 'dragEnd.flickity', function( event, pointer ) { $(this).removeClass('is-dragging'); }) $gallery.magnificPopup({ delegate: '.lightbox-img, .lightbox-video', callbacks: { elementParse: function(item) { if(item.el.context.className == 'lightbox-video') { item.type = 'iframe'; } else { item.type = 'image'; } } }, type: 'image', closeBtnInside:false, gallery:{ enabled:true } }); /* Lightbox popup -------------------------------------------------------*/ $('.lightbox-img, .lightbox-video').magnificPopup({ callbacks: { elementParse: function(item) { if(item.el.context.className == 'lightbox-video') { item.type = 'iframe'; } else { item.type = 'image'; } } }, type: 'image', closeBtnInside:false, gallery: { enabled:true }, image: { titleSrc: 'title', verticalFit: true } }); // Single video lightbox $('.single-video-lightbox').magnificPopup({ type: 'iframe', closeBtnInside:false, tLoading: 'Loading image #%curr%...' }); /* Final Countdown (Coming soon) -------------------------------------------------------*/ var dataEnd = $("#countdown").attr('data-end-date'); $("#countdown") .countdown(dataEnd, function(event) { var $this = $(this).html(event.strftime('' + '