bootstrap modal with carousel,如何用不同的幻灯片打开模态?

时间:2017-08-26 15:45:08

标签: bootstrap-modal bootstrap-4 bootstrap-carousel

我正在利用启动模态的标准bootstrap方法并在模态中显示旋转木马。

因此,根据他们使用哪个按钮来触发模态,我希望旋转木马幻灯片不同。

下面是目前为止的代码,但我无法使用数据幻灯片来选择模态中的幻灯片。

页面上的

按钮:

<button type="button" data-toggle="modal" data-target="#tile-modal" data-tile="0" data-slide-to="0" data-position="0" class="btn btn-xs btn-default">Slide 1</button>

<button type="button" data-toggle="modal" data-target="#tile-modal" data-tile="1" data-slide-to="1" data-position="1" class="btn btn-xs btn-default">Slide 2</button>

模态:

<div class="modal fade fill-in" id="tile-modal" tabindex="-1" role="dialog" aria-labelledby="modalFillInLabel" style="display: none;" aria-hidden="true">
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
    <i class="far fa-times"></i>
  </button>
  <div class="modal-dialog ">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="text-left p-b-5">Available <span class="semi-bold">Tiles</span></h5>
      </div>
      <div class="modal-body">
        <div class="row">
          <div class="col-12">
            <div id="carouselExampleControls" class="carousel slide" data-interval="false" data-ride="carousel">
              <div class="carousel-inner" role="listbox">
                <div class="carousel-item">
                  <div class="col-12 padding-5">
                    <div class="tile-block red text-white b-a b-grey">
                      <div class="card-header d-flex align-items-center p-t-5 p-l-15 p-r-15">
                        <div class="card-title col-6">Delivery Summary</div>
                        <div class="clearfix"></div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="carousel-item active">
                  <div class="col-12 padding-5">
                    <div class="tile-block blue text-white b-a b-grey b-dashed">
                      <div class="card-header d-flex align-items-center p-t-5 p-l-15 p-r-15">
                        <div class="card-title col-6">Delivery Status</div>
                        <div class="clearfix"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
              </a>
              <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>

0 个答案:

没有答案