views:

36

answers:

1

Hi

I have a site with width 100% and height 100% and overflow hidden on the body. So its a fullscreen website using a jquery full screen background image plugin. On one page I have a list of thumbnails, each thumb is set to float left so it fills the entire window with thumb images.

With overflow set to hidden, when too many thumbnails are on the page they disappear at the bottom. I am looking for a jquery script that will automatically scale up or down the thumbnails when the window is resized so ALL thumbs are always visible I saw a script like this before but didnt book mark it...

Anyone here know of a script that would do this?

Thanks

A: 

I'd imagine it would look something like this:

$(window).resize(function() {
  var _newWidth = `<calc here>`; //calc new Width here based on window size
  var _newHeight = `<calc here>`; //calc new Height here based on window size
  $("img.thumb").css({width: _newWidth, height: _newHeight}); 
});

Sorry, there isn't any actual scaling calc but it should be pretty simple using $(window).height() & $(window).width() to get the values needed.

J Pollock
Thanks guys. Just wondering, what would the calc be? As we wont know what the browser width and height will be. Just need all thumbs to scale down or up. In your explanation, give each thumb a class of "thumb?" thanks alot!
Rob