ie8支持html5zoo,complete styles for cross browser CSS zoom

In response to the above comment by @martin (he is correct), I created a complicated workaround using javascript (includes some jQuery) and some of @Mr. Alien's css. Unquestionably, there are other ways to accomplish this - perhaps simpler, but, the following js and css combo works for me:

css

.zoom{

-moz-transform: scale(2); /* Firefox */

-moz-transform-origin: 0 0;

-o-transform: scale(2); /* Opera */

-o-transform-origin: 0 0;

zoom:2 /*IE*/;

}

//Notice the absence of any Webkit Transforms

javascript

(function($){

var version=false,

isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0,

isOpera=!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0,

isChrome=!!window.chrome && !isOpera;

if(isChrome){

version=(window.navigator.appVersion.match(/Chrome\/(\d+)\./)!==null) ?

parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) :

0;

version=(version >= 10) ? true : false;

// Don't know what version they switched it. Figured that this was a good guess

}

// I added the extra ternary check in there because when testing in Chrome,

// if I switched the user agent in the overrides section, it kept failing with

// null value for version.

if(isSafari || version){

$('.zoom').css('-webkit-transform','scale(2)');

$('.zoom').css('-webkit-transform-origin','0 0');

// If Scaling based upon different resolutions, a check could be included here

// for window size, and the css could be adjusted accordingly.

}

}(jQuery))

The browser detection code came from here and the Chrome version detection snippet came from this post.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值