jQuery script to scale up or down thumbnails on window resize
I ha开发者_Python百科ve 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
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.
精彩评论