LEFT | RIGHT |
(Both sides are equal) |
1 /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyrig
ht (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ | 1 /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyrig
ht (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ |
2 /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr
or otherwise, you don't need this part */ | 2 /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr
or otherwise, you don't need this part */ |
3 (function(w) { | 3 (function(w) { |
4 "use strict"; | 4 "use strict"; |
5 w.matchMedia = w.matchMedia || function(doc, undefined) { | 5 w.matchMedia = w.matchMedia || function(doc, undefined) { |
6 var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild
|| docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createEl
ement("div"); | 6 var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild
|| docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createEl
ement("div"); |
7 div.id = "mq-test-1"; | 7 div.id = "mq-test-1"; |
8 div.style.cssText = "position:absolute;top:-100em"; | 8 div.style.cssText = "position:absolute;top:-100em"; |
9 fakeBody.style.background = "none"; | 9 fakeBody.style.background = "none"; |
10 fakeBody.appendChild(div); | 10 fakeBody.appendChild(div); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 respond.getEmValue = getEmValue; | 215 respond.getEmValue = getEmValue; |
216 function callMedia() { | 216 function callMedia() { |
217 applyMedia(true); | 217 applyMedia(true); |
218 } | 218 } |
219 if (w.addEventListener) { | 219 if (w.addEventListener) { |
220 w.addEventListener("resize", callMedia, false); | 220 w.addEventListener("resize", callMedia, false); |
221 } else if (w.attachEvent) { | 221 } else if (w.attachEvent) { |
222 w.attachEvent("onresize", callMedia); | 222 w.attachEvent("onresize", callMedia); |
223 } | 223 } |
224 })(this); | 224 })(this); |
LEFT | RIGHT |