From 302f60902570b79f22ae38c5192c8f83f3d32069 Mon Sep 17 00:00:00 2001 From: David Kerr Date: Thu, 26 Apr 2018 14:29:47 -0400 Subject: [PATCH] shhhhhhh --- js/plugins.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/js/plugins.js b/js/plugins.js index 7a09437..b81fa8b 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -117,8 +117,22 @@ // The width and height of the captured photo. We will set the // width to the value defined here, but the height will be // calculated based on the aspect ratio of the input stream. + var width = 0 + function myFunction(x) { + if (x.matches) { // If media query matches + width = 240; + } else { + width = 480; + } + } + + var x = window.matchMedia("(max-width: 500px)") + myFunction(x) // Call listener function at run time + x.addListener(myFunction) // Attach listener function on state changes + + - var width = 480; // We will scale the photo width to this + // We will scale the photo width to this var height = 0; // This will be computed based on the input stream // |streaming| indicates whether or not we're currently streaming