jQuery图片自适应宽度插件jQuery.imgAutoSize.js
2014-04-28 12:48:25 -0400
调用方法:
- 代码: 全选
-
jQuery(function ($) {
// .imgWrap这个是图片外部容器,使用了本插件后超大的图片宽度将会限制在容器宽度
// 如果要控制图片与容器的边距,如20像素: $('.imgWrap').imgAutoSize(20);
$('.imgWrap').imgAutoSize();
});
DEMO:
- 代码: 全选
-
<html>
<style type="text/css">
.wrap{
width: 50px;
}
</style>
<body>
<div class="wrap">
<img src="http://code.zhangyun.org/down/20140429/279587/20080528104708431.jpg" />
<script src="http://c.wodemo.com/distribution/279585/d006ef681b60de212333d96bea5910a5/jquery.min.js"></script>
<script src="http://zhangyun.wodemo.com/entry/279585/1966906cc5e6d0f26adad699c2064500/jQuery.imgAutoSize.js"></script>
<script type="text/javascript">
jQuery(function ($) {
$('.wrap').imgAutoSize();
});
</script>
</div>
</body>
</html>
Back to home
Subscribe |
Register |
Login
| N