0

我需要有关我的模态的帮助,它只是不会显示。我似乎找不到什么问题。下面是代码

 <body>
    <!--[if lt IE 7]>
        <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
    <![endif]-->
<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span><img src="img/logo.png"></span>
      </button>
        <a class="navbar-brand" href="#">Cotton Board of Zambia</a>
    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#contact">Contact</a></li>

      </ul>
      <form class="navbar-form navbar-right">
        <div class="form-group">
          <input type="text" placeholder="search" class="form-control">
        </div>

        <button type="submit" class="btn btn-success">Search</button>


    </form>

    </div>
  </div>
</div>

 <table id="maintable" >
     <tr>
         <td>
            <table align="left" width="100%">
                <tr>
                    <td><p><a data-toggle="modal" href="#reglog" class="btn btn-primary btn-large">Register & Login</a></p></td>
                    <td>
                    <!--register/login modal-->
                        <div class="modal hide fade in" id="reglog"  style="display: none; " >
                        <div class="modal-header">
                        <h4>Cotton Board of Zambia</h4><br>
                        <h6>Login Here</h6>
                        </div>
                        <div class="modal-body">
                            <form>
                            <label>Some text</label>
                            <input type="text">

                            </form>


                        </div>

                        <div class="modal-footer">
                        <button class="btn" data-dismiss="modal" aria-hidden="true">close</button>
                        <a href="#" class="btn" data-dismiss="modal">Close</a>  
                        </div>


                        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>  
                        <script src="/js/modal.js"></script>  



                    </td>
                </tr>
            </table>
         </td>
         <td>
             <table align="right" width="100%">
                <tr>
                    <td>
                        <div><h3>Our Location</h3></div>
                  <div id="map">
                     <div id="map_canvas" style="width: 200px; height: 300px;"></div>
                   </div>
                    </td>
                </tr>
            </table>
         </td>
     </tr>
  </table>
   <div><hr/></div>
  <footer>
    <p>&copy;  2013</p>
  </footer>
</div> <!-- /container -->        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
    <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.1.js"><\/script>');</script>

    <script src="js/vendor/bootstrap.min.js"></script>

    <script src="js/main.js"></script>

    <script>
        var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
        (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
        g.src='//www.google-analytics.com/ga.js';
        s.parentNode.insertBefore(g,s)}(document,'script'));
    </script>
</body>

从我对 HTML 5 的一点了解来看,代码应该可以工作。请帮我弄清楚为什么模态不会显示在浏览器中。我还按照建议添加了链接并下载了 Modal.js,但模态仍然不会显示在我的浏览器中。请帮助。

4

1 回答 1

0

您需要从此更改您的模态:

<div class="modal hide fade in" id="reglog"  style="display: none;" >

对此:

<div id="reglog" class="modal hide fade" tabindex="-1" role="dialog"
      aria-labelledby="myModalLabel" aria-hidden="true">

Bootstrap 会自动为你隐藏和显示模式,所以你不需要包含style="display:none;".

这是 Bootstrap 文档中模态的链接:http: //getbootstrap.com/2.3.2/javascript.html#modals

于 2013-10-28T15:20:47.830 回答