/* this prevents dom flickering for elements hidden with js, needs to be outside of dom.ready event.also adds several extra classes for better browser support this is a separate file that needs to be loaded at the top of the page. other js functions are loaded before the closing body tag to make the site render faster */ "use strict" var avia_is_mobile = false; if( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.useragent) && 'ontouchstart' in document.documentelement) { avia_is_mobile = true; document.documentelement.classname += ' avia_mobile '; } else { document.documentelement.classname += ' avia_desktop '; } document.documentelement.classname += ' js_active '; (function(){ //set transform property var prefix = ['-webkit-','-moz-', '-ms-', ""], transform = ""; for (var i in prefix) { // http://artsy.github.io/blog/2012/10/18/so-you-want-to-do-a-css3-3d-transform/ if(prefix[i]+'transform' in document.documentelement.style) { document.documentelement.classname += " avia_transform "; transform = prefix[i]+'transform'} if(prefix[i]+'perspective' in document.documentelement.style) document.documentelement.classname += " avia_transform3d "; } //set parallax position to prevent jump at pageload if(typeof document.getelementsbyclassname == 'function' && typeof document.documentelement.getboundingclientrect == "function" && avia_is_mobile == false) { if(transform && window.innerheight > 0) { settimeout(function(){ var y = 0, offsets = {}, transy = 0, parallax = document.getelementsbyclassname("av-parallax"), wintop = window.pageyoffset || document.documentelement.scrolltop; for (y = 0; y < parallax.length; y++) { parallax[y].style.top = "0px"; offsets = parallax[y].getboundingclientrect(); transy = math.ceil( (window.innerheight + wintop - offsets.top) * 0.3 ); parallax[y].style[transform] = "translate(0px, "+transy+"px)"; parallax[y].style.top = "auto"; parallax[y].classname += ' enabled-parallax '; } }, 50); } } })();