Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 19 of 19
#imgId {
/* Set the width dynamically depending on the width of the browser window */
width:100%;
/* dont enlarge the image more, than its initial resolution */
max-width:1000px;
max-height:765px;
/* Set the height dynamically depending on the image's current width, keeping the aspect ratio */
height:auto;
}
function adjustRatio(img)
{
if(window.innerHeight < img.height)
{
img.style.height = '100%';
img.style.width = 'auto';
}
else if(window.innerWidth < img.width)
{
img.style.width = '100%';
img.style.height = 'auto';
}
}
adjustRatio(document.getElementById('theIdOfYourImage'));
window.innerHeight
...
window.innerWidth
document.body.clientHeight
...
document.body.clientWidth
1 to 19 of 19