chris.carlin
6/8/2018 - 5:00 AM

Viewport Update JS

/*
 * Get Viewport Dimensions
 * returns object with viewport dimensions to match css in width and height properties
*/
function updateViewportDimensions() {
	var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
	return { width:x,height:y }
}
// setting the viewport width
var viewport = updateViewportDimensions();

/*
  viewport = updateViewportDimensions();
  if (viewport.width >= 768) {}
*/