2012-06-28 49 views
1

當我在具有特定樣式(邊距,浮點等等)的音頻或視頻標籤上使用mediaelement.js時,渲染效果不好。保持原始的CSS樣式

有沒有辦法保持mediaelement.js呈現原始CSS樣式?

感謝

回答

1

我解決我的問題與此代碼:

$(function(){ 
    $("video,audio").mediaelementplayer(); 
    $("video,audio").each(function(){ 
     $(this).parents(".mejs-container").css("float", $(this).css("float")); 
     $(this).css("float", "none"); 
     $(this).parents(".mejs-container").css("marginTop", $(this).css("marginTop")); 
     $(this).parents(".mejs-container").css("marginRight", (($(this).css("marginRight")=="0px")?"auto":$(this).css("marginRight"))); 
     $(this).parents(".mejs-container").css("marginBottom", $(this).css("marginBottom")); 
     $(this).parents(".mejs-container").css("marginLeft", (($(this).css("marginLeft")=="0px")?"auto":$(this).css("marginLeft"))); 
     $(this).css("marginTop", "auto"); 
     $(this).css("marginRight", "auto"); 
     $(this).css("marginBottom", "auto"); 
     $(this).css("marginLeft", "auto"); } 
    ); 
}); 
0

嗯,有很多的媒體元素玩家得到的呈現方式的變化。對於類型的視頻/ YouTube,它實際上成爲一個iframe。

但是我能夠通過查看開發人員工具中的檢查員來確定id。對我來說,id是'mep_0'。所以,我能夠補充:

#mep_0 
{ 
    margin: 0 auto; 
} 

不是優雅的,但它的工作原理。

相關問題