Jquery image scale
Jquery image scale
Out of context: Reply #4
- Started
- Last post
- 9 Responses
- hotroddy0
*/ to maintain aspect ratio
var scale = 1;
var imageWidth = srcImg.getAttribute('width');
var imageHeight = srcImg.getAttribute('height');
scale = windowH / imageHeight;imageHeight = imageHeight * scale;
imageWidth = imageWidth * scale;$("#img").css("height", imageHeight);
$("#img").css("width", imageWidth);