-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathizilla.mq.debug.min.js
16 lines (15 loc) · 1.2 KB
/
izilla.mq.debug.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
* Izilla Media Query Debugger v1.0
* Adds the viewport width and height as a :before pseudo element on the body to help with obtaining values for responsive breakpoints if a url parameter of mqdebug=true exists.
*
* eg. rwd.html?mqdebug=true
* Needs to be referenced after opening <body> tag
*
* Copyright (c) 2012 Izilla Partners Pty Ltd
*
* http://www.izilla.com.au
*
* Licensed under the MIT license
*
*/
(function(){var f=/(&|\?)(\w+)=true/gi,h=window.location.href,a,d="",e={};while(a=f.exec(h)){d+=" "+a[2];e[a[2]]=true}if(e.mqdebug===true&&typeof(window.innerWidth)!="undefined"){var b=document.head,c=document.createElement("style"),g=document.createTextNode('body[data-mqd]:before {background:red;border:1px solid #900;color:#fff;content:attr(data-mqd);font-family:"Courier New",Courier,monospace;font-size:12px;left:0;line-height: 16px;padding:3px 6px 5px 6px;position:fixed;top:0;z-index:9999;}');c.type="text/css";if(c.styleSheet){c.styleSheet.cssText=g.nodeValue}else{c.appendChild(g)}b.appendChild(c);document.body.setAttribute("data-mqd",window.innerWidth+" x "+window.innerHeight);window.onresize=function(i){document.body.setAttribute("data-mqd",window.innerWidth+" x "+window.innerHeight)}}})();