Facebook Twitter Pinterest Share

vBulletin 3.X Add-ons & Template Modifications All the latest vBulletin 3.X Add-ons & Template Modifications.


New Thread  Post Reply
Galeras's Avatar
Galeras : 50+
Galeras is a glorious beacon of lightGaleras is a glorious beacon of lightGaleras is a glorious beacon of lightGaleras is a glorious beacon of lightGaleras is a glorious beacon of lightGaleras is a glorious beacon of light
offline Joined: Sep 2007 Location: Promyshlennyi Vorkuta Posts: 164 Thanked: 47
  #1  
Thread Starter Unread 10-11-07
javascript %Fluid Image Resizer%

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.
<!-- 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

Last edited by Galeras; 11-24-08 at 01:30 PM. Reason: working with ie7
sleepless's Avatar
sleepless : Newbie
sleepless is on a distinguished road
offline Joined: Dec 2007 Posts: 3 Thanked: 0
  #2  
Unread 12-29-07
For me it's work fine with Opera 9.24, Firefox 2 and also IE7.

Good Job!! Thanks.

Last edited by sleepless; 12-29-07 at 09:55 PM.
Jozelito's Avatar
Jozelito : Newbie
Jozelito is on a distinguished road
offline Joined: Dec 2007 Posts: 4 Thanked: 0
  #3  
Unread 12-30-07
wow.... Great Job Galeras .....Thanks....
aying's Avatar
aying : Member
aying is on a distinguished road
offline Joined: Mar 2008 Posts: 32 Thanked: 0
  #4  
Unread 03-14-08
It works on 3.6.8 version, no hassle at all thanks
New Thread  Post Reply

Thread Tools

Bookmarks
  • Submit Thread to Facebook
  • Submit Thread to Twitter
  • Submit Thread to Pinterest
  • Submit Thread to LinkedIn
  • Submit Thread to Reddit
Tags
% resizer, fluid, fluid resizer, image resizer, variable resizer, resizer%, image, %fluid, javascript
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Powered by GYSN Underground 2021