-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevtools.js
23 lines (19 loc) · 906 Bytes
/
devtools.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function() {
'use strict';
let viewportX = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
let viewportY = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
let div = document.createElement('div');
div.setAttribute('id', 'dev-tools');
document.body.appendChild(div);
div.classList.add('show');
div.onmouseover = function(){
div.classList.toggle('switch');
};
window.addEventListener('resize', init);
function init() {
viewportX = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
viewportY = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
div.innerHTML = '<span class="alt-color">width:</span>' + viewportX + 'px <span class="alt-color">height:</span>' + viewportY + 'px';
};
init();
}());