简体   繁体   English

CSS 跨浏览器问题

[英]CSS cross-browser issue

I'm making a numbers game for people studying English as a second language.我正在为学习英语作为第二语言的人制作一个数字游戏。 It's using a WordPress plugin that uses HTML5 and, as a fallback, Flash -- this will be important for me because many target users of my game will be in Asia where older browsers are used.它使用了 WordPress 插件,该插件使用 HTML5 以及作为后备的 Flash - 这对我来说很重要,因为我的游戏的许多目标用户将在亚洲使用旧版浏览器。 The game involves 16 audio tracks that are all invisible on the page and one random one will be made visible via javascript fade in once the user clicks the start button.游戏包含 16 个音轨,这些音轨在页面上都是不可见的,一旦用户单击开始按钮,一个随机的音轨将通过 javascript 淡入显示。

Problem: In Chrome and Safari, the audio player is successfully hidden via CSS display: none .问题:在 Chrome 和 Safari 中,音频播放器通过 CSS display: none成功隐藏。 However, in my Firefox 5, the browser is (for some reason unknown to me, but it's good that this problem has arisen) using the Flash playeer and the styles are not applying to it, so there's 16 audio players on the screen in Firefox. However, in my Firefox 5, the browser is (for some reason unknown to me, but it's good that this problem has arisen) using the Flash playeer and the styles are not applying to it, so there's 16 audio players on the screen in Firefox .

This is the CSS I am using.这是我正在使用的 CSS。

Do you know a way to make this CSS apply to the flash player as well?你知道如何让这个 CSS 也适用于 flash 播放器吗? The 16 audio tracks have ids from 1 - 16 16 个音轨的 ID 为 1 - 16

#ONE, #TWO, #THREE, #FOUR, #FIVE, #SIX, #SEVEN, #EIGHT, #NINE, #TEN, #ELEVEN, #TWELVE, #THIRTEEN, #FOURTEEN, #FIFTEEN, #SIXTEEN {position: absolute; left: 0px; top: 0px; display: none; } 

This is a link to the game.这是游戏的链接。 Note, the game is unfinished so don't expect to play it.请注意,游戏尚未完成,所以不要指望玩它。 Right now you can only see the CSS problem depending on your browser.现在您只能看到 CSS 问题,具体取决于您的浏览器。

NumbersGame数字游戏

behavior confirmed on Firefox 3 too. Firefox 3 上的行为也得到了证实。

Here what i see with firebug on the 5th audio:这是我在第 5 个音频中看到的萤火虫:

<div style="">
 <object id="f-FIVE" width="290" height="24" type="application/x-shockwave-flash"         name="f-FIVE" style="outline: medium none; visibility: visible;" data="http://eslangel.com /wp-content/plugins/degradable-html5-audio-and-video/incl/player.swf">
  <param name="wmode" value="opaque">
  <param name="menu" value="false">
  <param name="flashvars" value="initialvolume=80&soundFile=http://eslangel.com/wp-content/uploads/2011/07/five.mp3&playerID=f-FIVE">
</object> 

We can see that the style of your object id="f-FIVE" is visibility=visible.我们可以看到你的 object id="f-FIVE" 的样式是visibility=visible。

If you change it to hidden the control is hidden.如果将其更改为隐藏,则控件将被隐藏。

First of all you should be using the HTML5 DOCTYPE.首先,您应该使用 HTML5 DOCTYPE。

Secondly, you seem to be serving MP3 files only which aren't supported by Firefox, which only supports OGG.其次,您似乎只提供 Firefox 不支持的 MP3 文件,它只支持 OGG。

Using Firebug I can see that none of the many divs surrounding the Flash player actually has display:none set at all.使用 Firebug,我可以看到 Flash 播放器周围的许多 div 中没有一个实际上有display:none设置。

At the end of each <!-- degradable html5 audio and video plugin --> line there is some JavaScript that looks like this:在每个<!-- degradable html5 audio and video plugin -->行的末尾有一些 JavaScript 看起来像这样:

if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();

Which seems to be saying that if the browser is mozilla, then it should show the div that you have set to display:none .这似乎是说,如果浏览器是 mozilla,那么它应该显示您设置为display:none的 div 。 What was you intention for this bit of code?你对这段代码的意图是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM