html中rem布局后,在背景图片压缩后,根据压缩比例计算代码
2016-07-15 11:20
549 查看
html中rem布局后,在背景图片压缩后,根据压缩比例计算代码
<script type="text/javascript"> $(document).ready(function() { var tWidth = $(window).width(); var tHeight = $(window).height(); //重新计算所有img大小 var dpi_w = tWidth / 640; var dpi_h = tHeight / 1008; $("img").each(function() { $(this).width($(this).width() * dpi_w); $(this).height($(this).height() * dpi_h); }); }); </script>
相关文章推荐
- Android布局的小窍门?
- Web布局连载——两栏固定布局(五)
- 在Windows 8.1的IE 11中屏蔽双击放大功能
- HTML5调用摄像头实例
- Powershell 创建炫丽美观的Html报表
- Apple官网研究之使用Justify布局导航
- 关于前端的思考与感悟
- 又被事件冒泡坑了一把,这次要彻底弄懂浏览器的事件流
- 移动端点击事件全攻略,这里的坑你知多少?
- $q 实例分析 Angular 中的 Promise
- Angular directive 实例详解
- 关于浮动与清除浮动,你应该知道的
- 如何在 Ubuntu Linux 中使用 RAR 文件
- Mootools 1.2教程 函数
- autoit InputBox 函数
- 按右键另存图片只能存BMP
- photoshop去除图片上的水印
- 文件遍历排序函数