jQuery确定CSS缩放在浏览器中是否可用 [英] jquery determine if css zoom is available in browser
问题描述
$(button).click(function(){
if (Modernizr.zoom()) $('body').animate({ zoom: '200%'; }, 1000);
else $('body').alternative();
});
您可以在上方看到…我想点击放大到我的页面.
As you can see above … I want to zoom in into my page on click.
顺便说一句:使用'zoom'(css)是否很好?我不确定,因为找不到"zoom"(css)的任何详细描述.还是使用缩放"(css)进行动画制作更好?
By the way: Is it good to use 'zoom' (css)? I'm not sure because I did not find any good description for 'zoom' (css). Or is it better to use 'scale' (css) to animate?
主要问题:有什么方法可以检测浏览器是否支持css-'zoom'(或其他功能)功能? 我使用的是Modernizr,但是在Modernizr中,没有任何东西可以检测缩放"是否可用.
Main Question: Is there any way to detect if the browser supports this css-'zoom' (or whatever) feature? I'm using Modernizr, but within Modernizr there is nothing to detect if 'zoom' is available.
推荐答案
确定.我发现,使用css zoom-property不好,因为它只能在IE和某些真实"浏览器的较新版本中使用.并且,如果我的布局具有百分比值,则不会缩放,除非我还会更改width或height的值,这不是很好.
OK. I found out, that using the css zoom-property is not good, because it only works in IE and some newer versions of "real" browsers. AND if i have a layout with percent-values it doesn't zoom except i also change the value of the width or height, which is not nice.
但是它确实与css3的scale-property一起使用!因此,我发现了Modernizr.csstransforms()
功能检测(针对js)!
BUT it does work with the css3 scale-property! and therefore i found the Modernizr.csstransforms()
feature detection (for js)!
所以……就这样!
这篇关于jQuery确定CSS缩放在浏览器中是否可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!