Tip: Click lines to highlight, hold ctrl/cmd to multi-select
Viewport (30-Dec @ 12:43)
Syntax Highlighted Code
- function getViewportHeight() {
- var height = self.innerHeight; // Safari, Opera
- var mode = document.compatMode;
- if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko
- height = (mode == 'CSS1Compat') ?
- document.documentElement.clientHeight : // Standards
- document.body.clientHeight; // Quirks
- }
- return height;
- }
- function getViewportWidth() {
- var width = self.innerWidth; // Safari, Opera
- var mode = document.compatMode;
- if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko
- width = (mode == 'CSS1Compat') ?
- document.documentElement.clientWidth : // Standards
- document.body.clientWidth; // Quirks
- }
- return width;
- }
Plain Code
function getViewportHeight() {
var height = self.innerHeight; // Safari, Opera
var mode = document.compatMode;
if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko
height = (mode == 'CSS1Compat') ?
document.documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
return height;
}
function getViewportWidth() {
var width = self.innerWidth; // Safari, Opera
var mode = document.compatMode;
if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko
width = (mode == 'CSS1Compat') ?
document.documentElement.clientWidth : // Standards
document.body.clientWidth; // Quirks
}
return width;
}