2012-06-28 47 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; 
} 

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

相关问题