Bootstrap 3透明和全屏模态

时间:2016-08-17 15:21:31

标签: jquery bootstrap-modal

我正在使用此网站http://www.minimit.com/demos/bootstrap-3-transparent-and-fullscreen-modals的代码和我的模式,但我不能忽视它。该按钮不起作用。

请查看您是否看到我可能错过的任何内容。          

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Queen Of The Fairies</title>

    <!-- Bootstrap Core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/background.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

    <!--Favicon-->
    <link rel="apple-touch-icon" sizes="57x57" href="ico/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="ico/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="ico/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="ico/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="ico/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="ico/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="ico/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="ico/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="ico/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192"  href="ico/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="ico/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="ico/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="ico/favicon-16x16.png">
    <link rel="manifest" href="/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="ico/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link href="https://fonts.googleapis.com/css?family=Abel" rel="stylesheet">

    <script>
    $(".modal-fullscreen").on('show.bs.modal', function () {
      setTimeout( function() {
        $(".modal-backdrop").addClass("modal-backdrop-fullscreen");
      }, 0);
    });
    $(".modal-fullscreen").on('hidden.bs.modal', function () {
      $(".modal-backdrop").addClass("modal-backdrop-fullscreen");
    });
    </script>
</head>

<body>
<!--Open Navbar-->
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html"><img src="logo1.png"></a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li>
          <a class="active" data-toggle="modal" data-target="#modal-fullscreen" href="#introModal">INTRO <span class="sr-only">(current)</span></a>
        </li>
        <li><a href="#">PRICING</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">SERVICES <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">TAROT CARD</a></li>
            <li><a href="#">REIKI</a></li>
            <li><a href="#">AXIOTONAL</a></li>
            <li><a href="#">HEALING</a></li>
            <li><a href="#">MASSAGE</a></li>
          </ul>
          </li><!--CLOSE DROPDOWN-->
          <li><a href="#">CONTACT</a></li>
      </ul>

      <ul class="nav navbar-nav navbar-right">
        <li>
            <a class="modal-link" data-toggle="modal" data-target="#modal-fullscreen" href="#aboutModal">ABOUT ME</a>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav><!--Close Navbar-->

<!-- aboutModal fullscreen -->
<div class="modal modal-fullscreen fade" id="modal-fullscreen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="aboutModal">ABOUT ME</h4>
      </div>
      <div class="modal-body">
        <img src="images/about_me.jpg" class="img-circle img-responsive center-block">
            <p class="text-justify">
                My name is Tanja Eklund Almon and I am a gifted healer and psychic reader. I have been doing this for the entirety of my lifetime and I have done readings for a lot of people over the years. I have always had positive responses and experiences. If you require a tarot card reading or would like to relax in complete meditation and immerse yourself in a reiki session. Perhaps you would like to experience an axiotonal realignment, please do not hesitate to call or email me.<br><br>If you require immediate assistance you may click on the chat widget below and I'll be with you shortly...</p><br/>
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary btn-lg center-block" data-toggle="modal" data-target="#aboutModal" data-dismiss="modal"> OK </button>
      </div>
    </div>
  </div>
</div>

<!-- introModal fullscreen -->    
<div class="modal modal-fullscreen fade" id="modal-fullscreen" tabindex="-1" role="dialog" aria-labelledby="introModal" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="introModal">ABOUT ME</h4>
      </div>
      <div class="modal-body">
        <img src="images/fairy.png" class="img-square img-responsive center-block">
            <p text-justify>My name actually means "Queen of the Fairies" and out of that idea arose my business name. A colleague once told me that I was primarily attuned to water and that my power was generated from that realm.  I am the real thing and sometimes it is scary real. I can truly identify information hidden from the normal senses. The word "psychic" is also used as an adjective to describe these abilities.</p>
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary btn-lg center-block" data-toggle="modal" data-target="#introModal" data-dismiss="modal"> OK </button>
      </div>
    </div>
  </div>
</div>

    <!-- jQuery -->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/scripts.js"></script>

    <!-- Fullscreen modals JS-->
    <!-- include jQuery -->
    <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>

    <!-- include bootstrap -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

</body>
<footer id="footer">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12 col-md-12 col-lg-12">
                    <ul class="social-icons">
                        <li><a href="https://www.facebook.com/" class="facebook"><i class="fa fa-facebook" style="color: #3b5998;"></i></a></li>
                        <li><a href="https://twitter.com/" class="twitter"><i class="fa fa-twitter" style="color: #00aced;"></i></a></li>
                        <li><a href="https://plus.google.com/" class="google"><i class="fa fa-google-plus" style="color: #dd4b39;"></i></a></li>
                        <li><a href="https://ca.linkedin.com/in/" class="linkedin"><i class="fa fa-linkedin" style="color: #007bb6;"></i></a></li>
                    </ul>
                    <div class="copyright">
                        <p class="pull-right text-muted small"><a href="http://www.kimosabeit.com">Designed by:  Dale Sawanas &copy; Kimosabe IT</a></p><br>
                    </div>
                </div>
            </div>
        </div>
    </footer>
</html>

2 个答案:

答案 0 :(得分:0)

关闭按钮上的data-target="#introModal"指向<h4>标记,而不是模式的包装元素。

尝试将data-target更改为#modal-fullscreen,这是模式的最外层元素。

答案 1 :(得分:0)

我测试你的代码,它在这里工作得很好。 两种模态对我都有效。 但试试这个......

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>