在火狐切片盒
回答
它似乎並不兼容 - 他們承認:
請注意,您只能看到支持這些CSS3屬性(目前Chrome和 一個 瀏覽器Slicebox的COOL 3D效果蘋果瀏覽器)。
在閱讀代碼後,我可以找到原因。
所有樣式都使用-webkit
前綴編寫,但腳本檢查Modernizr.csstransforms3d
。 因此,當Firefox支持csstransforms3d
它試圖應用3D變換樣式,但Firefox將忽略所有樣式的前綴-webkit
。
我目前的解決方案是正確的前綴的所有樣式:
(function($){
if(Modernizr.csstransforms3d) {
var prefix = "";
if($.browser.mozilla){
prefix = "-moz-";
}else if($.browser.msie){
prefix = "-ms-";
}else if($.browser.opera){
prefix = "-o-";
}else{
return;
}
}
// Replace -webkit- with the current browser prefix
var postProcessStyles = function(styles){
$.each(styles,function(k,v){
styles[k.replace('-webkit-', prefix)] = typeof v === 'string' ? v.replace('-webkit-', prefix) : v;
styles[k.replace('-webkit-', '')] = typeof v === 'string' ? v.replace('-webkit-', '') : v;
});
}
// Inject style processor
var orig = $.Slice3d.prototype._configureStyles;
$.Slice3d.prototype._configureStyles = function(){
var origReturn = orig.apply(this,arguments),
_this = this;
postProcessStyles(this.style);
$.each(this.sidesStyles, function(k){
postProcessStyles(_this.sidesStyles[k]);
})
$.each(this.animationStyles, function(k){
postProcessStyles(_this.animationStyles[k]);
})
return origReturn;
}
}(jQuery));
工作不要做這個。這將在Firefox和Opera中打破,它們不會在變形前加上 – 2012-09-17 00:05:44
而是在postProcessStyles中使用'Modernizr.prefixed('transform')'。它會正確地告訴你使用什麼樣式的屬性。 http://modernizr.com/docs/#prefixed – 2012-09-17 00:07:25
謝謝@PaulIrish我試過'Modernizr.prefixed(k.replace(' - webkit-',''))'但是這隻會導致奇怪的效果。我添加了一行來刪除我的代碼中的前綴。你對此有何看法? – jantimon 2012-09-17 08:41:44
- 1. 切片盒,鏈接圖片
- 2. httpsessionstate在火狐
- 3. DOMContentLoaded在火狐中
- 4. 在IE,火狐,Safari
- 5. 圖片不IE,火狐,和Safari
- 6. 圖片與火狐alignent問題
- 7. ckeditor慢火狐
- 8. 點 - 點火狐
- 9. 火狐緩存
- 10. 火狐window.parent.location
- 11. 火狐刷新
- 12. Soapui和火狐
- 13. 拉文::火狐
- 14. 火狐obj.style.hasOwnProperty
- 15. 火狐:日誌
- 16. 角2 - 火狐
- 17. jquery切換不工作在鉻,但在IE和火狐工作
- 18. 盒陰影CSS與<fieldset>。火狐VS鉻
- 19. window.XMLHttpRequest在Chrome VS火狐
- 20. 火狐onpopuphidden在OS X
- 21. history.back()不會在Chrome /火狐
- 22. FireEvent在IE 11 /火狐
- 23. Div在火狐重疊
- 24. scrollTop打破在火狐
- 25. ASP.NET XML只在火狐
- 26. CSS不mozila火狐
- 27. 按鍵爲火狐
- 28. Paypal結帳火狐
- 29. 火狐回發出
- 30. 降級火狐8
的問題是,回退不用於Firefox – jantimon 2012-09-11 14:20:54