Template:UrbanTundra Edmonton/main-js

(function () {

'use strict';


var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } };

var fullHeight = function() {

if ( !isMobile.any() ) { $('.js-fullheight').css('height', $(window).height()); $(window).resize(function(){ $('.js-fullheight').css('height', $(window).height()); }); }

};

var sliderMain = function() {

$('#ute-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); }

});

$('#ute-hero .flexslider .slides > li').css('height', $(window).height()); $(window).resize(function(){ $('#ute-hero .flexslider .slides > li').css('height', $(window).height()); });

};

var centerBlock = function() { $('.ute-section-with-image .ute-box').css('margin-top', -($('.ute-section-with-image .ute-box').outerHeight()/2)); $(window).resize(function(){ $('.ute-section-with-image .ute-box').css('margin-top', -($('.ute-section-with-image .ute-box').outerHeight()/2)); }); };

var responseHeight = function() { setTimeout(function(){ $('.js-responsive > .v-align').css('height', $('.js-responsive > img').height()); }, 1);

$(window).resize(function(){ setTimeout(function(){ $('.js-responsive > .v-align').css('height', $('.js-responsive > img').height()); }, 1); }) };


var mobileMenuOutsideClick = function() {

$(document).click(function (e) { var container = $("#ute-offcanvas, .js-ute-nav-toggle"); if (!container.is(e.target) && container.has(e.target).length === 0) {

if ( $('body').hasClass('offcanvas-visible') ) {

   			$('body').removeClass('offcanvas-visible');
   			$('.js-ute-nav-toggle').removeClass('active');

}


} });

};


var offcanvasMenu = function() { $('body').prepend('<div id="ute-offcanvas" />');

$('#ute-offcanvas').prepend('