resizeImg

by mirowin

HTML

<img class="resImg" src="http://cs625521.vk.me/v625521867/1605a/Ka0S9DSmW-s.jpg">

CSS

* {
    padding:0px 0px 0px 0px;
    margin:0px 0px 0px 0px;
}
body {
    overflow:hidden;
}
img {
}

JavaScript

function resizeImage() {

    var wWindow = $(window).width();
    var hWindow = $(window).height();

    if ($('.resImg').width() >= wWindow) {
        $(".resImg").css({
            width: $(window).height() * 1.5 + 'px'
        });
    } else {
        $(".resImg").css({
            width: $(window).width() + 'px'
        });
    }
}
resizeImage();
$(window).resize(resizeImage);