更改引导程序的大小弹出

时间:2016-10-26 10:35:35

标签: html twitter-bootstrap

我不确定在哪里可以编辑我的投资组合中的bootstrap模式弹出窗口?这是本网站底部的辣椒图片。目前它显示在1000 * 600px,但我希望它更大。

Link to my portfolio

HTML

<div class="col-md-3 col-sm-6 col-xs-12">
            <article class="block-thumbnail">
                    <div class="block-image">
                        <div class="overlay"></div>
                        <img
                            class="coursepic"   
                            src="/images/thumbs/image1.jpg" 
                            data-toggle="modal" 
                            data-target="#myModal1" 
                            alt="Trolltunga, Norway"
                        >   
                    </div>
                <div class="block-data">
                    <h3>
                        Test
                    </h3>
                </div>
            </article>
        </div>

CSS

img.coursepic {
    width: 100%;
    height: 100%;
}
img.coursepic:hover{
    cursor: pointer;
    opacity: 0.5;
    background: rgba(0,0,0,0.5);
    border-radius: 2px;
    width: 100%;
    height: 100%;
}

JS

function centerModal() {
    $(this).css('display', 'block');
    var $dialog = $(this).find(".modal-dialog");
    var offset = ($(window).height() - $dialog.height()) / 2;
    // Center modal vertically in window
    $dialog.css("margin-top", offset);
}

$('.modal').on('show.bs.modal', centerModal);
$(window).on("resize", function () {
    $('.modal:visible').each(centerModal);
});

3 个答案:

答案 0 :(得分:1)

对于data-target="#myModal1"#myModel1应该获得modal-lg

并添加class="coursepic modal-lg"

或使用此

&#13;
&#13;
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Large Modal</h2>
  <!-- Trigger the modal with a button -->
   <img class="coursepic" data-toggle="modal" data-target="#myModal" src="http://placehold.it/350x150" />
 

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog modal-lg">
      <div class="modal-content">
       
          <button type="button" class="close" data-dismiss="modal">&times;</button>
         
        </div>
        <div class="modal-body">
           <img class="coursepic" src="http://placehold.it/350x150" />
        </div>
       
      </div>
    </div>
  </div>
</div>

</body>
</html>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

它与var SomeView = Backbone.View.extend({ initialize:function() { $(window).on("storage", this.handleLocalStorageChange) } });

一起正常工作

modal-lg

中添加此代码段
centerModal()

enter image description here

答案 2 :(得分:0)

Bootstrap确实有一些内置样式来创建不同大小的模式:

这里重要的课程是 modal-lg

&#13;
&#13;
<div class="modal-dialog modal-lg">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title">Modal Header</h4>
    </div>
    <div class="modal-body">
      <p>This is a large modal.</p>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;