Skip to content

Instantly share code, notes, and snippets.

View jvrunion's full-sized avatar

John Vincent Runion jvrunion

View GitHub Profile
@taylor-rowe
taylor-rowe / viewport-tracking.js
Last active November 24, 2020 21:25
A simple script to track viewport size and orientation on page load or when either changes
(function() {
//first we will find the current width and height and declare a few variables that we'll use later
var vW = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var vH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var orientation = null;
var viewRange = null;
//enter the pixel values that trigger your responsive design
var breakpoints = [480, 992, 1200];