Thickbox scales down a large image???

Discussion in 'JavaScript' started by 123GoToAndPlay, Oct 6, 2008.

  1. #1
    How do i prevent this?

    image is 757px × 2263px and i would like to show it in a thickbox popup with
    
    <a href="large-image.gif" title="larger" class="thickbox">test large</a>
    
    Code (markup):
    but the image scales to fit the browser (i think)

    Any advice, examples how to fix this??
     
    123GoToAndPlay, Oct 6, 2008 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    this is normal for modal viewers - the modal (an opacity layer) tries to sit on top of your current browser with it's window size, the image is fitted above it. the idea is you don't leave the page you are looking at, or scroll - to view an image.

    if your image is too big and would require the width and height of the browser scrollSize to change to accommodate it, it kind of defeats the purpose, you may as well send them to a new page instead...

    anyway, you can try playing with this, perhaps removing it may work:
    // Resizing large images - orginal by Christian Montoya edited by me.
          var pagesize = tb_getPageSize();
          var x = pagesize[0] - 150;
          var y = pagesize[1] - 150;
          var imageWidth = imgPreloader.width;
          var imageHeight = imgPreloader.height;
          if (imageWidth > x) {
            imageHeight = imageHeight * (x / imageWidth); 
            imageWidth = x; 
            if (imageHeight > y) { 
              imageWidth = imageWidth * (y / imageHeight); 
              imageHeight = y; 
            }
          } else if (imageHeight > y) { 
            imageWidth = imageWidth * (y / imageHeight); 
            imageHeight = y; 
            if (imageWidth > x) { 
              imageHeight = imageHeight * (x / imageWidth); 
              imageWidth = x;
            }
          }
          // End Resizing
    PHP:
    replace with just:
          var imageWidth = imgPreloader.width;
          var imageHeight = imgPreloader.height;
    PHP:
     
    dimitar christoff, Oct 6, 2008 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @dimitar, i hear you. But in my case it would be one image which is bigger of a total of 4. I like the user to use the next and prev.

    Tx, for you code i will play with it.
     
    123GoToAndPlay, Oct 6, 2008 IP
  4. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #4
    the controls will go outside the visible screen anyway... if too tall that is. in fact, i don't know how he places the close and next/previous buttons anyway... seems like thickbox needs some work though.
     
    dimitar christoff, Oct 6, 2008 IP
  5. Chios

    Chios Well-Known Member

    Messages:
    1,740
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    195
    #5
    What do you mean ?
    4 pixels more ? for whose screen ?
    Do you know all of your users screen sizes ?

    I would love it as is, thickbox is very well thought of ...
     
    Chios, Oct 6, 2008 IP
  6. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    @chios, sorry but i meant a total of 4 images.
    FYI: 3 images are just 400x300 and 1 is 757px × 2263px
     
    123GoToAndPlay, Oct 6, 2008 IP