2013-04-04 36 views
0

我試圖使用'perspective:'和'transform:translateZ'css屬性來定位div的深度。我有它在Chrome中工作,但不是在IE10或Firefox20。 你可以看到測試here,「誰是未來」菜單頁...-ms-perspective不能在Internet Explorer 10中工作

含div有CSS類.scroller:

.scroller { 
    position: relative; 
    perspective: 150; 
    -webkit-perspective: 150; 
    -ms-perspective: 150; 
    -moz-perspective: 150; 
} 

而且,對於內部的div,translateZ設置使用jQuery:

$(this).css('transform', 'translateZ(-' + ((1-$(this).css('opacity')) * 80) + 'px)');       
$(this).css('-webkit-transform', 'translateZ(-' + ((1-$(this).css('opacity')) * 80) + 'px)'); 
$(this).css('-ms-transform', 'translateZ(-' + ((1-$(this).css('opacity')) * 80) + 'px)'); 
$(this).css('-moz-transform', 'translateZ(-' + ((1-$(this).css('opacity')) * 80) + 'px)'); 

但是,它不適用於IE10或Firefox20。有什麼我錯過了嗎?

回答

2

「的角度看之前 的屬性,它在Internet Explorer 10和 更高版本支持前綴的。「不要使用Microsoft供應商前綴(」 -ms-)」 - MSDN.

+0

我原來沒有'-ms-'前綴,它不起作用。有沒有其他的原因,它不工作? – moosefetcher 2013-04-04 13:20:38

+1

@moosefetcher真的嗎?我猜這是在這種情況下,如果它不在ie10中工作的一些其他原因,因爲MSDN似乎很清楚它可能:/奇怪 – lifetimes 2013-04-04 13:23:15

+0

@moosefetcher檢查此鏈接是否在IE10中使用,可能是一個對你沒什麼用處 - http://blogs.msdn.com/b/ie/archive/2012/02/02/css3-3d-transforms-in-ie10.aspx – lifetimes 2013-04-04 13:30:39

相關問題