Currently I am working off of this code to resize an image with javascript
function resize(which) {
var elem = document.getElementById(which);
if (elem == undefined || elem == null) return false;
if (max == undefined) {
if (elem.width > document.documentElement.clientWidth) {
} else if (elem.height > document.documentElement.clientHeight) {
} else if (elem.height > document.documentElement.clientHeight && elem.height > document.documentElement.clientWidth) {
}
}
if (elem.width > elem.height) {
if (elem.width > max)
elem.width = max;
} else {
if (elem.height > max)
elem.height = max;
}
}
I was wondering if I am heading in the right direction to resize an Image with javascript if the image is bigger then the clients viewport. I'd like some help with this also as I don't know what to do next to finish the code. Thanks. :)