You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
640 B
29 lines
640 B
/*
|
|
Makes
|
|
*/
|
|
|
|
document.addEventListener("DOMContentLoaded", function(event) {
|
|
var img = document.getElementById('main-background');
|
|
|
|
if(isLoaded(img)) {
|
|
var width = img.clientWidth;
|
|
var height = img.clientHeight;
|
|
|
|
if(width > (height * 1.50)) {
|
|
img.className += ' landscape';
|
|
}
|
|
} else {
|
|
img.onload = function () {
|
|
var width = img.clientWidth;
|
|
var height = img.clientHeight;
|
|
|
|
if(width > (height * 1.50)) {
|
|
img.className += ' landscape';
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
function isLoaded(img) {
|
|
return img.complete && typeof(img.naturalHeight) !== 'undefined' && img.naturalHeight !== 0;
|
|
}
|