//Custom code //equal height function defination $=jQuery; equalheight = function(container){ "use strict"; var currentTallest = 0, currentRowStart = 0, currentDiv = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).each(function() { $el = $(this); $($el).height('auto') window.topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } // ==> Slider code for home page $(function(){ "use strict"; if($('div').hasClass('slider')){ $('.slider').fractionSlider({ 'fullWidth': false, 'controls': false, 'pager': true, 'responsive': true, 'increase': true, 'pauseOnHover': false, 'slideEndAnimation': true, 'dimensions' : '1200, 370', 'timeout' : 1000, // default timeout before switching slides 'speedIn' : 1000, // default in - transition speed 'speedOut' : 1000 }); } // ==> Team slider if($('div').hasClass('teamSlider')){ $(".teamSlider").owlCarousel({ navigation : true, itemsCustom : [ [1600, 4], [1200, 4], [980, 3], [748, 2], [320, 1] ] }); } // ==> equal height function application equalheight($(".serviceNav li")); $('.collapsBefore').css({ display:'none', overflow:'hidden' }); $(".navContainer").sticky({ topSpacing: 0 }); //scroll to top $().UItoTop({ easingType: 'easeOutQuart' }); }); /*=================================== = LOADING BAR = ===================================*/ var timer; (function(){ "use strict"; var position = 0; var loadingBar = document.getElementById('loading-bar'); var inner = document.getElementById('inner'); var max = 100; timer = setInterval(function(){ var widthToSet = position + ((max - position)/10); if (inner) { inner.setAttribute("style", "width:"+ widthToSet +"%"); } position = widthToSet; }, 250); })(); // ==> On window load events $(window).load(function() { "use strict"; //Sorting effect if($('nav').hasClass('sortItems')){ var $container = $('.sortItems ul').isotope({ // options }); // filter items on button click $('.sorter li a').on( 'click', function(x) { x.preventDefault(); $('.sorter li').removeClass('active'); $(this).parent('li').addClass('active'); var filterValue = $(this).parent('li').attr('data-filter'); $container.isotope({ filter: filterValue }); }); } clearInterval(timer); var inner = document.getElementById('inner'); if (inner) { inner.setAttribute("style", "width:"+ 100 +"%"); } setTimeout(function(){ $("body").addClass("loaded"); $("body").removeClass("loading"); }, 500); $('.collapsBefore').delay(1000).slideDown(1000); $('.numbers').addClass('timeCounter'); //parallax effect var $winWidth= $(window).width(); if($winWidth > 619){ if($('.success').length>0){ $('.success').parallax("50%", .1); } } else{ if($('.success').length>0){ $('.success').parallax("50%", 0); } } //nice scroll for page var nice = false; nice = $("body").niceScroll({scrollspeed:100, mousescrollstep:70, smoothscroll:true, bouncescroll:true}); }); // ==> window resize events $(window).resize(function(){ "use strict"; equalheight($(".serviceNav li")); if($('.sortItems ul').length>0){ $('.sortItems ul').isotope(); } //parallax effect on resize var $winWidth= $(window).width(); if($winWidth > 619){ if($('.success').length>0){ $('.success').parallax("50%", .1); } } else{ if($('.success').length>0){ $('.success').parallax("50%", 0); } } }); //scroll functions $(window).scroll(function () { "use strict"; if($('.numbers').length>0){ var counterTop = $('.numbers').offset().top-500; var ScrollTop = $(window).scrollTop(); if (ScrollTop > counterTop) { $('.timeCounter').each( function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); }); $('.numbers').removeClass('timeCounter'); } } }); // ==> scroll sections jQuery(function( $ ){ "use strict"; //borrowed from jQuery easing plugin //http://gsgd.co.uk/sandbox/jquery.easing.php $.easing.elasout = function(x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }; // sorting buttons $('.mainNav li a').click(function(){ $(this).parent('li').siblings('li').removeClass('active'); var $target =$(this).attr('href'); var $winWidth =$( window ).width(); if ($winWidth < 619){ if($('#home').length>0){ $.scrollTo( $($target), {duration:1000} ); } } else{ if($('#home').length>0){ $.scrollTo( $($target), {duration:1000, offset:-80} ); } } $(this).parent('li').addClass('active'); }); $('.msgBtn').click(function(){ var $winWidth =$( window ).width(); if ($winWidth < 619){ if($('#home').length>0){ $.scrollTo( $('#contact'), {duration:1000} ); } } else{ if($('#home').length>0){ $.scrollTo( $('#contact'), {duration:1000, offset:-80} ); } } }); $('.menu').on('click', function(){ $('.open').animate("left", 0); }); }); //fade in effect for divs /** * jQuery Unveil-Effects * - Modified version of (http://luis-almeida.github.com/unveil) to detect only when the item is in viewport * * - Author: @geedmo * - URI: https://github.com/geedmo */ ! (function($) { "use strict"; //------------------------------- // Plugin definition //------------------------------- $.fn.unveilEffect = function(callback, threshold) { var $w = $(window), th = threshold || 0, images = this, loaded, inview, source; this.one('unveil.trans', callback) function unveil() { inview = images.filter(function() { var $e = $(this), wt = $w.scrollTop(), wb = wt + $w.height(), et = $e.offset().top, eb = et + $e.height(); return eb >= wt - th && et <= wb + th; }); loaded = inview.trigger("unveil.trans"); images = images.not(loaded); } $w.scroll(unveil).resize(unveil).load(unveil); return this; }; //------------------------------- // Defaults can be override //------------------------------- var unveilEffectSettings = $.extend({ transitionDuration: 0.5 , transitionEasing: "ease-in-out" , selector: '[data-trans]' , threshold: 100 }, (typeof(unveilEffectSettings) != 'undefined' ? unveilEffectSettings : false)); $('.summary-header__anchor-list a').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 }, 1000); return false; } } }); //------------------------------- // Autorstart on document ready //------------------------------- $(function() { // transition name detection $.fn.unveilEffect.transition = (function () { var el = document.createElement('bs') var transEndEventNames = { 'WebkitTransition' : '-webkit-transition' , 'MozTransition' : '-moz-transition' , 'OTransition' : '-o-transition' , 'transition' : '-transition' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { css: transEndEventNames[name] } } } })(); // if no transition support, do nothing if( ! $.fn.unveilEffect.transition) return; var animSelector = $(unveilEffectSettings.selector); animSelector .each(function() { var $this = $(this), effectName = $this.data('trans'); // add effect class and force reflow $this.addClass('trans-' + effectName)[0].offsetWidth; $this.css($.fn.unveilEffect.transition.css, 'all ' + unveilEffectSettings.transitionDuration + 's ' + unveilEffectSettings.transitionEasing) }) .unveilEffect(function() { // activate animation $(this).addClass('wb') }, (- unveilEffectSettings.threshold) ) }); })(window.jQuery);