Skip to content

Instantly share code, notes, and snippets.

View benald's full-sized avatar

Benald benald

  • Perth, Australia
View GitHub Profile
// Viewport detection
//
//
//
define([
"jquery"
],
function ($) {
var module = {
@benald
benald / Cross-browser viewport height and width JS variables
Created September 20, 2019 01:27
An accurate cross browser / device viewport measurement
// Set cross-browser viewport height and width variable
viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
viewWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);