基于 https://github.com/yonran/detect-zoom 修改
主要修改一下几点。
- 增加对 IE7 的支持
- 增加支持检测字体缩放的
- 修改 Webkit 在 Chrome 27+ 上面失效的问题
- 增加 Demo 演示
http://alphatr.github.io/detect-zoom/
Detect-zoom 提供了三个方法:
zoom()
返回当前屏幕缩放比.device()
返回在当前屏幕缩放比下的设备像素比 (Read more about devicePixelRatio at QuirksMode)- 'zoomText()' 返回文字的缩放比
<script src="detect-zoom.js"></script>
<script>
var zoom = detectZoom.zoom();
var device = detectZoom.device();
console.log(zoom, device);
</script>
AMD Usage
require(['detect-zoom'], function(detectZoom){
var zoom = detectZoom.zoom();
});
2013/11/16
- 增加对 IE7 的支持
- 增加支持检测字体缩放的
- 修改 Webkit 在 Chrome 27+ 上面失效的问题
- 增加 Demo 演示
2013/1/26
- Repository moved here
- Refactored most of the code
- Removed support for older browsers
- Added support for AMD and CommonJS
2013/1/27
- Added a fix to Mozilla's (Broken - https://bugzilla.mozilla.org/show_bug.cgi?id=809788) implementation of window.devicePixel starting Firefox 18
2013/2/05
- Merged a pull request that fixed zoom on IE being returned X100 (thanks @kreymerman)
- Refactored the code some more, changed some function names
- Browser dependent main function is created only on initialization (thanks @jsmaker)
- Open Issue: Firefox returns
zoom
anddevicePixelRatio
the same. Still looking for a solution here. - Started versioning - this is version 1.0.0
在 Retina 屏幕的 FireFox 浏览器会出现问题。
Detect-zoom is dual-licensed under the WTFPL and MIT license, at the recipient's choice.