【问题标题】:The Bootstrap modal in React js is not workingReact js 中的 Bootstrap 模式不起作用
【发布时间】:2017-09-12 15:20:03
【问题描述】:

我正在关注本教程 (https://www.bigbinary.com/videos/keep-up-with-reactjs/creating-a-bootstrap-modal-in-react-js)

创建一个模态,但我有这个问题。

灰色层不会让我使用模态。我已经检查了 css 文件,但我不知道我在哪里做错了。

请帮帮我

这是我的代码:

登录.js

import React, { Component,PropTypes } from 'react';


class Login extends React.Component {
    render() {

        return (
          <div>
  <button type="button" id='ingresar' data-toggle="modal" data-target="#myModal">
    Ingresar
  </button>

  <div className="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div className="modal-dialog">
      <div className="modal-content">
        <div className="modal-header">
          <button type="button" className="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span className="sr-only">Close</span></button>
          <h4 className="modal-title" id="myModalLabel">Modal title</h4>
        </div>
        <div className="modal-body">
          ...
        </div>
        <div className="modal-footer">
          <button type="button" className="btn btn-default" data-dismiss="modal">Close</button>
          <button type="button" className="btn btn-primary">Save changes</button>
        </div>
      </div>
    </div>
  </div>
          </div>

        );
    }
}

【问题讨论】:

  • 问题应该出在你的css上。将模态的 z-index 更改为更高的值。
  • 但无法更改 z 索引 :(
  • 您好@EmmanuelGarciaMartinez 问题已解决,如果解决请回答解决方案
  • @Becauseihatemyself 我必须构建自己的模式,我非常喜欢它,因为我可以更好地控制方面

标签: javascript css reactjs


【解决方案1】:

我也有同样的问题。我发现我的问题与fade 类有关。一旦我删除它,我的问题就解决了。

【讨论】:

  • 真的吗?我不得不删除模式,但我会尽力做你告诉我的谢谢
猜你喜欢
  • 1970-01-01
  • 2023-02-09
  • 2019-12-03
  • 1970-01-01
  • 2023-03-23
  • 1970-01-01
  • 2019-07-03
  • 2014-06-15
  • 2018-08-06
相关资源
最近更新 更多