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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 respond.getEmValue = getEmValue; | 264 respond.getEmValue = getEmValue; |
265 function callMedia() { | 265 function callMedia() { |
266 applyMedia(true); | 266 applyMedia(true); |
267 } | 267 } |
268 if (w.addEventListener) { | 268 if (w.addEventListener) { |
269 w.addEventListener("resize", callMedia, false); | 269 w.addEventListener("resize", callMedia, false); |
270 } else if (w.attachEvent) { | 270 } else if (w.attachEvent) { |
271 w.attachEvent("onresize", callMedia); | 271 w.attachEvent("onresize", callMedia); |
272 } | 272 } |
273 })(this); | 273 })(this); |
LEFT | RIGHT |