;(function () { 'use strict'; // iPad and iPod detection var isiPad = function(){ return (navigator.platform.indexOf("iPad") != -1); }; var isiPhone = function(){ return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) ); }; var fullHeight = function() { $('.js-fullheight').css('height', $(window).height()); $(window).resize(function(){ $('.js-fullheight').css('height', $(window).height()); }); }; var burgerMenu = function() { $('.js-fh5co-nav-toggle').on('click', function(event) { event.preventDefault(); var $this = $(this); if( $('body').hasClass('menu-show') ) { $('body').removeClass('menu-show'); $('#fh5co-main-nav > .js-fh5co-nav-toggle').removeClass('show'); } else { $('body').addClass('menu-show'); setTimeout(function(){ $('#fh5co-main-nav > .js-fh5co-nav-toggle').addClass('show'); }, 900); } }) }; // Animations var contentWayPoint = function() { var i = 0; $('.animate-box').waypoint( function( direction ) { if( direction === 'down' && !$(this.element).hasClass('animated') ) { i++; $(this.element).addClass('item-animate'); setTimeout(function(){ $('body .animate-box.item-animate').each(function(k){ var el = $(this); setTimeout( function () { var effect = el.data('animate-effect'); if ( effect === 'fadeIn') { el.addClass('fadeIn animated'); } else { el.addClass('fadeInUp animated'); } el.removeClass('item-animate'); }, k * 200, 'easeInOutExpo' ); }); }, 100); } } , { offset: '85%' } ); }; var sliderMain = function() { $('#fh5co-hero .flexslider').flexslider({ animation: "fade", slideshowSpeed: 5000, directionNav: true, start: function(){ setTimeout(function(){ $('.slider-text').removeClass('animated fadeInUp'); $('.flex-active-slide').find('.slider-text').addClass('animated fadeInUp'); }, 500); }, before: function(){ setTimeout(function(){ $('.slider-text').removeClass('animated fadeInUp'); $('.flex-active-slide').find('.slider-text').addClass('animated fadeInUp'); }, 500); } }); $('#fh5co-hero .flexslider .slides > li').css('height', $(window).height()); $(window).resize(function(){ $('#fh5co-hero .flexslider .slides > li').css('height', $(window).height()); }); }; var counter = function() { $('.js-counter').countTo({ formatter: function (value, options) { return value.toFixed(options.decimals); }, }); }; var counterWayPoint = function() { if ($('#counter-animate').length > 0 ) { $('#counter-animate').waypoint( function( direction ) { if( direction === 'down' && !$(this.element).hasClass('animated') ) { setTimeout( counter , 400); $(this.element).addClass('animated'); } } , { offset: '90%' } ); } }; // Document on load. $(function(){ fullHeight(); burgerMenu(); counter(); sliderMain(); contentWayPoint(); counterWayPoint(); }); }());