Click for fullsize on post images

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

http://www.ozzu.com/sutra412342.html#412342

Quote:
OK.. I noticed the board distorted my image by a lot.. I had it 640 x (smaller size), but the board messed it up.. Here's the new image with better quality:


This is no doubt due to the max-width applied to images inside posts that keeps them from creating scrollbars, I've had the same issue on a buddys board.

The image bbcode in use over there applied a "bbcode" CSS classname to images posted, so a simple javascript worked out ok.

It rigs images of class "bbcode" to open in a new window when clicked, & still allows the max-width CSS to do its' thing.

Code: [ Select ]
function clickableImages(){
    var images = document.getElementsByTagName('img');
    for(var i=0; i<images.length; i++){
        if(images.item(i).className == 'bbcode'){
            images.item(i).style.cursor = 'pointer';
            images.item(i).title = 'View Fullsize';
            images.item(i).onclick = function(){
                window.open(this.src, 'imageviewer');
            }
        }
    }
}

if(window.addEventListener){
    window.addEventListener('load', clickableImages, false);
}else if(window.attachEvent){
    window.attachEvent('onload', clickableImages);
}
  1. function clickableImages(){
  2.     var images = document.getElementsByTagName('img');
  3.     for(var i=0; i<images.length; i++){
  4.         if(images.item(i).className == 'bbcode'){
  5.             images.item(i).style.cursor = 'pointer';
  6.             images.item(i).title = 'View Fullsize';
  7.             images.item(i).onclick = function(){
  8.                 window.open(this.src, 'imageviewer');
  9.             }
  10.         }
  11.     }
  12. }
  13. if(window.addEventListener){
  14.     window.addEventListener('load', clickableImages, false);
  15. }else if(window.attachEvent){
  16.     window.attachEvent('onload', clickableImages);
  17. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.