/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var maxWidth = 320; var adjustmentSet = document.getElementById('col-main').getElementsByTagName('img'); for (var i=0; i < adjustmentSet.length; i++) { if(adjustmentSet[i].width > maxWidth){ adjustmentSet[i].removeAttribute('height'); adjustmentSet[i].style.width = '100%'; } }