Does anyone know how to resize images proportionally using JavaScript?
I have tried to modify the DOM by adding attributes height and width
height
width
okay it solved, here is my final code
if($(this).width() > $(this).height()) { $(this).css('width',MaxPreviewDimension+'px'); $(this).css('height','auto'); } else { $(this).css('height',MaxPreviewDimension+'px'); $(this).css('width','auto'); }
Thanks guys