javascript %Fluid Image Resizer%

Galeras

New Member
After try many many mods and scripts, i found a good looking simple one. But was to vb 3.4 or 3.5 i think. So I edited to work on fluid styles of vb 3.6.8.

Add this into the headinclude template, at any point.
Code:
<!-- Resizerrr -->
<if condition="THIS_SCRIPT == 'showthread'"> 
<script type="text/javascript"> 
function resizeImages() { 
  if (document.images) { 
    var bw = window.document.body.clientWidth;
    var mw = bw*0.80; 
    for (var ii = 0; ii < document.images.length; ii++) { 
      var i = document.images[ii]; 
      var iw = i.width; 
        if (iw > mw) { 
        i.style.width = 99 + '%'; 
      } 
    } 
  } 
} 
if (window.addEventListener) { 
  window.addEventListener('load', resizeImages, false); 
} else if (window.attachEvent) { 
  window.attachEvent('onload', resizeImages); 
} else { 
  window.onload = resizeImages; 
} 
//--> 
</script> 
</if>
<!--/ Resizerrr -->

If the image width is larger then 80% of your browser resolution, will be resized to 90% of it's original size.
-
Q: Why not screen ?
A: Because some ppl with widescreen use non-maximazed browser window
-
Q: Why 80%?
A: 80% is aproximally the max size of the postbit used to show images in fluid styles of vb


Works with: Opera 9, FF 2, IE7
Doesn't work with IE6!

Any suggestions? bugs?

This is script was adapted by me, but feel free to copy/share/modify in anyway
 
Top