(function($){ //create closure so we can safely use $ as alias for jquery $(document).ready(function(){ "use strict"; /*-----------------------------------------------------------------------------------*/ /* superfish menu /*-----------------------------------------------------------------------------------*/ // initialise plugin var example = $('.sf-menu').superfish({ //add options here if required delay: 100, speed: 'fast', autoarrows: false }); /* portfolioisotope */ var portfolioisotope = function(){ if ( $('.product-wrap').length ) { $('.product-wrap').each(function() { var self = $(this); var filternav = self.find('.product-filter').find('a'); var productisotope = function($selector){ $selector.isotope({ filter: '*', itemselector: '.product-item', percentposition: true, animationoptions: { duration: 750, easing: 'liniar', queue: false, } }); } self.children().find('.isotope-container').imagesloaded( function() { productisotope(self.children().find('.isotope-container')); }); $(window).load(function(){ productisotope(self.children().find('.isotope-container')); }); filternav.click(function(){ var selector = $(this).attr('data-filter'); filternav.removeclass('active'); $(this).addclass('active'); self.find('.isotope-container').isotope({ filter: selector, animationoptions: { duration: 750, easing: 'liniar', queue: false, } }); return false; }); }); } } /* waypoint */ var progressbar = function() { $('.progress-bar').on('on-appear', function() { $(this).each(function() { var percent = $(this).data('percent'); $(this).find('.progress-animate').animate({ "width": percent + '%' },1000); $(this).parent('.roll-progress').find('.perc').addclass('show').animate({ "width": percent + '%' },1000); }); }); }; var counter = function() { $('.roll-counter').on('on-appear', function() { $(this).find('.numb-count').each(function() { var to = parseint($(this).attr('data-to')); $(this).countto({ to: to, }); }); }); //counter }; var detectviewport = function() { $('[data-waypoint-active="yes"]').waypoint(function() { $(this).trigger('on-appear'); }, { offset: '90%', triggeronce: true }); $(window).on('load', function() { settimeout(function() { $.waypoints('refresh'); }, 100); }); }; var removepreloader = function() { $('.loader-wrap').css('opacity', 0); settimeout(function(){$('.loader-wrap').hide();}, 600); } $(function() { portfolioisotope(); progressbar(); counter(); detectviewport(); removepreloader(); }); /*-----------------------------------------------------------------------------------*/ /* slick mobile menu /*-----------------------------------------------------------------------------------*/ $('#primary-menu').slicknav({ prependto: '#slick-mobile-menu', allowparentlinks: true, label: '' }); $(window).load(function() { // executes when complete page is fully loaded, including all frames, objects and images $(".bottom-right").fadein('1000'); $(".bottom-right").fadein('1000'); }); /*-----------------------------------------------------------------------------------*/ /* back to top /*-----------------------------------------------------------------------------------*/ // hide #back-top first //$("#back-top").hide(); $(function () { // fade in #back-top $(window).scroll(function () { if ($(this).scrolltop() > 100) { $('.bottom-right #back-top.bottom-icon').css('visibility','visible'); } else { $('.bottom-right #back-top.bottom-icon').css('visibility','hidden'); } }); // scroll body to 0px on click $('#back-top').click(function () { $('body,html').animate({ scrolltop: 0 }, 400); return false; }); }); /*-----------------------------------------------------------------------------------*/ /* mobile menu & search /*-----------------------------------------------------------------------------------*/ /* mobile menu */ $('.slicknav_btn').click(function(){ $('.header-search').slideup('fast', function() {}); $('.search-icon > .genericon-search').removeclass('active'); $('.search-icon > .genericon-close').removeclass('active'); }); /* mobile search */ $('.search-icon > .genericon-search').click(function(){ $('.header-search').slidedown('fast', function() {}); $('.search-icon > .genericon-search').toggleclass('active'); $('.search-icon > .genericon-close').toggleclass('active'); $('.slicknav_btn').removeclass('slicknav_open'); $('.slicknav_nav').addclass('slicknav_hidden'); $('.slicknav_nav').css('display','none'); }); $('.search-icon > .genericon-close').click(function(){ $('.header-search').slideup('fast', function() {}); $('.search-icon > .genericon-search').toggleclass('active'); $('.search-icon > .genericon-close').toggleclass('active'); $('.slicknav_btn').removeclass('slicknav_open'); $('.slicknav_nav').addclass('slicknav_hidden'); $('.slicknav_nav').css('display','none'); }); }); })(jquery);