开发者

resize image based on browser resize (and keeping dimensions)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜