Jquery css 类似指南针的修正
当您使用 css 方法时,jQuery 具有不透明度校正(jQuery 1.4.2 上的第 4592-4608 行):
// IE uses filters for opacity
if ( !jQuery.support.opacity && name === "opacity" ) {
if ( set ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
}
return style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
"";
}
我已经开始扩展此行为以将 css 3 选择器多浏览器兼容(使用 Compass 框架实现)。
是否有一个项目已经这样做了?
jQuery has opacity correction when you use css method (lines 4592-4608 on jQuery 1.4.2):
// IE uses filters for opacity
if ( !jQuery.support.opacity && name === "opacity" ) {
if ( set ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// Set the alpha filter to set the opacity
var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
}
return style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
"";
}
I've started extending this behaviour to turn css 3 selectors multi browser compatible (using a lot of recipes that the Compass framework implements).
Is there a project that already does this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有各种项目涵盖 CSS3 的不同方面。 AFAIK 没有像样的统一项目。
我目前正在使用:
http://plugins.jquery.com/project/2d-transform
用于 CSS3 转换。我现在不太愿意推荐其他项目。
还有:
http://plugins.jquery.com/project/corners
There are various projects that cover different aspects of CSS3. AFAIK there's no decent unified project.
I'm currently using:
http://plugins.jquery.com/project/2d-transform
for CSS3 transforms. I can't really feel comfortable recommending other projects at this time.
There's also:
http://plugins.jquery.com/project/corners