( function( $ ) { "use strict"; $.fn.travelgemportfolio = function() { return this.each(function(i, elem){ var portfoliocontainer = jquery('.portfolio-container', elem); portfoliocontainer.imagesloaded(function(){ portfoliocontainer.isotope({ filter: '*', animationoptions: { duration: 750, easing: 'linear', queue: false } }); }); jquery('.portfolio-filter a', elem).on('click', function(e){ e.preventdefault(); jquery('.portfolio-filter .current', elem).removeclass('current'); jquery(this).addclass('current'); var selector = jquery(this).attr('data-filter'); portfoliocontainer.isotope({ filter: selector, animationoptions: { duration: 750, easing: 'linear', queue: false } }); return false; }); }); }; $(document).ready(function($){ $( '.portfolio-main-wrapper' ).travelgemportfolio(); $.fn.viewportchecker = function(useroptions){ // define options and extend with user. var options = { classtoadd: 'visible', offset: 100, callbackfunction: function(elem){} }; $.extend(options, useroptions); // cache the given element and height of the browser var $elem = this, windowheight = $(window).height(); this.checkelements = function(){ // set some vars to check with var scrollelem = ((navigator.useragent.tolowercase().indexof('webkit') != -1) ? 'body' : 'html'), viewporttop = $(scrollelem).scrolltop(), viewportbottom = (viewporttop + windowheight); $elem.each(function(){ var $obj = $(this); // if class already exists; quit if ($obj.hasclass(options.classtoadd)){ return; } // define the top position of the element and include the offset which makes is appear earlier or later var elemtop = math.round( $obj.offset().top ) + options.offset, elembottom = elemtop + ($obj.height()); // add class if in viewport if ((elemtop < viewportbottom) && (elembottom > viewporttop)){ $obj.addclass(options.classtoadd); // do the callback function. callback will send the jquery object as parameter options.callbackfunction($obj); } }); }; // run checkelements on load and scroll. $(window).on( 'scroll', this.checkelements ); this.checkelements(); // on resize change the height var. $(window).on( 'resize', function(e){ windowheight = e.currenttarget.innerheight; }); }; // search in header. if( $('.search-icon').length > 0 ) { $('.search-icon').on('click', function(e){ e.preventdefault(); $('.search-box-wrap').slidetoggle(); }); } // trigger mobile menu. $('#mobile-trigger').sidr({ timing: 'ease-in-out', speed: 500, source: '#mob-menu', renaming: false, name: 'mob-menu' }); $( '#mobile-trigger-quick' ).sidr({ timing: 'ease-in-out', side: 'right', speed: 500, source: '#mob-menu-quick', name: 'sidr-quick' }); $('#mob-menu').find( '.sub-menu,.flat-mega-memu' ).before( '' ); $('#mob-menu').find( '.dropdown-toggle').on('click',function(e){ e.preventdefault(); $(this).next('.sub-menu,.flat-mega-memu').slidetoggle(); $(this).toggleclass( 'toggle-on' ); }); // counter up. $('.counter-nos').counterup({ delay: 10, time: 1000 }); // fixed header. $(window).on('scroll', function() { if( $(window).scrolltop() > $('body').offset().top && !($('body').hasclass('sticky-header'))){ $('body').addclass('sticky-header'); } else if ( 0 === $(window).scrolltop() ) { $('body').removeclass('sticky-header'); } }); // slick carousel column 2. $(".iteam-col-2.section-carousel-enabled").slick({ dots: true, infinite: true, slidestoshow: 2, slidestoscroll: 2, dots: false, responsive: [ { breakpoint: 1024, settings: { slidestoshow: 2, slidestoscroll: 2, infinite: true } }, { breakpoint: 600, settings: { slidestoshow: 1, slidestoscroll: 1 } } ], prevarrow: '', nextarrow : '' }); // slick carousel column 3. $(".iteam-col-3.section-carousel-enabled").slick({ dots: true, infinite: true, slidestoshow: 3, slidestoscroll: 3, dots: false, responsive: [ { breakpoint: 1024, settings: { slidestoshow: 2, slidestoscroll: 2, infinite: true } }, { breakpoint: 600, settings: { slidestoshow: 1, slidestoscroll: 1 } } ], prevarrow: '', nextarrow : '' }); // slick carousel column 4 $(".iteam-col-4.section-carousel-enabled").slick({ dots: true, infinite: true, slidestoshow: 4, slidestoscroll: 4, dots: false, responsive: [ { breakpoint: 1024, settings: { slidestoshow: 2, slidestoscroll: 2, infinite: true } }, { breakpoint: 600, settings: { slidestoshow: 1, slidestoscroll: 1 } } ], prevarrow: '', nextarrow : '' }); // skil bar. jquery('.skillbar').each(function(){ jquery(this).find('.skillbar-bar').animate({ width:jquery(this).attr('data-percent') },3000); }); // lighbox. jquery('a[data-gal]').each(function() { jquery(this).attr('rel', jquery(this).data('gal')); }); jquery("a[data-gal^='prettyphoto']").prettyphoto({animationspeed:'slow',slideshow:false,overlay_gallery: false,theme:'light_square',social_tools:false,deeplinking:false}); // implement go to top. var $scroll_obj = $( '#btn-scrollup' ); $( window ).on('scroll',function(){ if ( $( this ).scrolltop() > 100 ) { $scroll_obj.fadein(); } else { $scroll_obj.fadeout(); } }); $scroll_obj.on('click', function(){ $( 'html, body' ).animate( { scrolltop: 0 }, 600 ); return false; }); $("#fakeloader").fakeloader({ timetohide:200, //time in milliseconds for fakeloader disappear zindex:"9999",//default zindex spinner:"spinner2",//options: 'spinner1', 'spinner2', 'spinner3', 'spinner4', 'spinner5', 'spinner6', 'spinner7' bgcolor:"#0b60a9", //hex, rgb or rgba colors }); $('a[href*="#demosz"]:not([href=""])').on('click', 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 - 0 }, 1000); return false; } } }); }); } )( jquery );