ZOOM:1的原理和作用

zoom:1确实帮我们解决了不少ie下的bug,但是它的来龙去脉,又有多少人知道呢?

所以我老生常谈,说一下它的来龙去脉。

Zoom属性是IE浏览器的专有属性, 它可以设置或检索对象的缩放比例

在平常的css编写过程中,zoom:1能够比较神奇地解决ie下比较奇葩的bug。

譬如外边距(margin)的重叠,譬如浮动的清除,譬如触发ie的 haslayout属性等等。

度娘告诉我们:zoom是 设置或检索对象的缩放比例。设置或更改一个已被呈递的对象的此属性值将导致环绕对象的内容重新流动。(没看懂)

虽然此属性不可继承,但是它会影响对象的所有子对象( children )。这种影响很像 background 和 filter 属性导致的变化。

此属性对于 currentStyle 对象而言是只读的,对于其他对象而言是可读写的。(没看懂)

(重点)当设置了zoom的值之后,所设置的元素就会就会扩大或者缩小,高度宽度就会重新计算了,这里一旦改变zoom值时其实也会发生重新渲染,运用这个原理,也就解决了ie下子元素浮动时候父元素不随着自动扩大的问题。

Zoom属是IE浏览器的专有属性,火狐和老版本的webkit核心的浏览器都不支持这个属性。然而,zoom现在已经被逐步标准化,出现在 CSS 3.0 规范草案中,也就是CSS3中的transform: scale这个属性来实现

用法:ie下子元素浮动时候父元素不随着自动扩大的问题,使用下面的CSS写法

.父元素 {   overflow: auto; zoom: 1   },关于更多清楚浮动的用法,可以戳http://www.cnblogs.com/dongtianee/p/4563084.html里面的第十问解释的很详细。


___ Using akZoom automatically for all 2D-plots in Matlab___ The standard usage of akZoom is "on demand", this means you have to call akZoom explicitly after plotting something like shown in the akZoom_examples.m file. However, if you are satisfied with the functionality, you can implement akZoom such that it is called automatically when calling plot, plotyy, etc.. To use akZoom automatically, you just have to include the folder "Wrapper of Matlab functions" to the Matlab search patch (here is how you do that: http://www.mathworks.de/de/help/matlab/ref/path.html). In this folder Matlab will find wrapper-functions for plot, plotyy, etc.. These wrapper-functions call the original functions and automatically add the akZoom call afterwards. Note: since we overload Matlabs own functions, you will get warnings like the following on Matlab startup: "Warning: Function ...\plot.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict." This can either just be ignored or, if it really bugs you, turned off with the following command: warning off MATLAB:dispatcher:nameConflict However, sometimes these kind of warnings can be usefull if you accidentally overload a Matlab function. So I recommend not to turn them off and just ignore them during startup. ___ Going back to default ___ If you do not want to call akZoom automatically, just remove the "Wrapper of Matlab functions" folder from the Matlab search path. ___ Using akZoom in GUIs ___ One important remark for GUI-programmers: When building an executable, Matlab somehow does not like it, when its built-in functions are overwritten. Therefore I recommend to call akZoom explicitly in the m-file of your GUI and remove the "Wrapper of Matlab functions" folder from the search path before building your application. If you have any questions or remarks just send me an email: alexander.kessel(at)mpq.mpg.de
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值