开发者

resize image based on browser resize (and keeping dimensions)

开发者 https://www.devze.com 2023-01-02 20:37 出处:网络
Google recently added backgrounds to it\'s home page .. Like it or hate it, it\'s got the ability to resize 开发者_开发百科the background image while keeping the same proportions as the browser window

Google recently added backgrounds to it's home page .. Like it or hate it, it's got the ability to resize 开发者_开发百科the background image while keeping the same proportions as the browser window resizes...

Anyone know of any jQuery to do that?


Width is set to a percentage.


$(window).resize(function() {
   $('#imgContainer').width( $(this).width() );
                     .height( $(this).height() );
});
0

精彩评论

暂无评论...
验证码 换一张
取 消