Google Chrome,Flash和z-index错误行为(Google Chrome, Flash and z-index wrong behaviour)
Google Chrome浏览器错误地显示Flash视频的z-index。
在Firefox或Internet Explorer中查看http://maxusglobal.com/ 。
现在在Chrome浏览器中查看它。
页面顶部的大视频应该在其顶部有一个“预览”图像z-indexed。 它在Firefox和Internet Explorer中执行,但不在Google Chrome中执行。
这似乎不是一个WebKit的事情,但特别是Chrome的错误。
我已经尝试了所有的模式,(不透明,窗口和透明),但是这不能解决它。 我还更改了Flash盒的z-index,但它仍然无法正常工作。
Google Chrome is displaying the z-index of a Flash video incorrectly.
Take a look at http://maxusglobal.com/ in Firefox or Internet Explorer.
Now take a look at it in Chrome.
The big video at the top of the page should have a "preview" image z-indexed over the top of it. It does in Firefox and Internet Explorer, but not Google Chrome.
This doesn't seem to be a WebKit thing, but specifically a Chrome bug.
I have tried all the wmodes, (opaque, window and transparent), but this doesn't fix it. I also changed the z-index of the Flash box, but it is still not working.
原文:https://stackoverflow.com/questions/4313364
最满意答案
正如@Alex McMillan提到的那样,使用状态来决定应该在dom中呈现的内容。
在下面的示例中,我有一个输入字段,我想在用户单击按钮时添加第二个字段,onClick事件处理函数调用handleAddSecondInput(),将inputLinkClicked更改为true。 我使用三元运算符来检查呈现第二个输入字段的真实状态
class HealthConditions extends React.Component { constructor(props) { super(props); this.state = { inputLinkClicked: false } } handleAddSecondInput() { this.setState({ inputLinkClicked: true }) } render() { return( <main id="wrapper" className="" data-reset-cookie-tab> <div id="content" role="main"> <div className="inner-block"> <H1Heading title="Tell us about any disabilities, illnesses or ongoing conditions"/> <InputField label="Name of condition" InputType="text" InputId="id-condition" InputName="condition" /> { this.state.inputLinkClicked? <InputField label="" InputType="text" InputId="id-condition2" InputName="condition2" /> : <div></div> } <button type="button" className="make-button-link" data-add-button="" href="#" onClick={this.handleAddSecondInput} > Add a condition </button> <FormButton buttonLabel="Next" handleSubmit={this.handleSubmit} linkto={ this.state.illnessOrDisability === 'true' ? "/404" : "/add-your-details" } /> <BackLink backLink="/add-your-details" /> </div> </div> </main> ); } }
As @Alex McMillan mentioned, use state to dictate what should be rendered in the dom.
In the example below I have an input field and I want to add a second one when the user clicks the button, the onClick event handler calls handleAddSecondInput( ) which changes inputLinkClicked to true. I am using a ternary operator to check for the truthy state, which renders the second input field
class HealthConditions extends React.Component { constructor(props) { super(props); this.state = { inputLinkClicked: false } } handleAddSecondInput() { this.setState({ inputLinkClicked: true }) } render() { return( <main id="wrapper" className="" data-reset-cookie-tab> <div id="content" role="main"> <div className="inner-block"> <H1Heading title="Tell us about any disabilities, illnesses or ongoing conditions"/> <InputField label="Name of condition" InputType="text" InputId="id-condition" InputName="condition" /> { this.state.inputLinkClicked? <InputField label="" InputType="text" InputId="id-condition2" InputName="condition2" /> : <div></div> } <button type="button" className="make-button-link" data-add-button="" href="#" onClick={this.handleAddSecondInput} > Add a condition </button> <FormButton buttonLabel="Next" handleSubmit={this.handleSubmit} linkto={ this.state.illnessOrDisability === 'true' ? "/404" : "/add-your-details" } /> <BackLink backLink="/add-your-details" /> </div> </div> </main> ); } }
相关问答
更多-
正如@Alex McMillan提到的那样,使用状态来决定应该在dom中呈现的内容。 在下面的示例中,我有一个输入字段,我想在用户单击按钮时添加第二个字段,onClick事件处理函数调用handleAddSecondInput(),将inputLinkClicked更改为true。 我使用三元运算符来检查呈现第二个输入字段的真实状态 class HealthConditions extends React.Component { constructor(props) { super(props) ...
-
编辑 :请参阅ES6更新示例的最终示例。 这个答案只是处理直接亲子关系的情况。 当父母和孩子有潜在的中介人时,请检查这个答案 。 其他解决方案也缺少一点 虽然他们仍然正常工作,但其他答案缺少一些非常重要的答案。 在React.js中,有没有一种简单的方法可以通过事件将孩子的道具传递给父母? 父母已经有那个孩子道具了! :如果孩子有道具,那是因为它的父母为孩子提供了道具! 你为什么要让孩子把道具传给父母,而父母显然已经有了这个道具? 更好的实施 孩子 :真的不一定比这更复杂。 var Child = Reac ...
-
有几个基本原则要牢记,可能有助于您构建一个很好的React应用程序: 您的UI应该是数据的一个功能 在许多“jQuery汤”风格的应用程序中,应用程序的业务逻辑,应用程序的数据和UI交互代码都是混合的。 这使得这些应用程序难以进行调试,特别是难以增长。 像许多现代客户端应用程序框架一样,React实现了一个想法,即UI只是您的数据的表示。 如果您希望您的UI更改,您应该更改一个数据,并允许框架用于更新UI的任何绑定系统。 在React中,每个组件(理想情况下)是传递给组件实例的属性以及组件在内部管理的状态的 ...
-
从简单的反应表组件开始: var Table= React.createClass({ render: function() { return