我正在使用bootstrap模态窗口,其中包含我的项目的下一个和上一个按钮,默认情况下" modal-footer"在底部。我想在模态窗口的垂直中心左右保持下一个和上一个按钮。
请建议。
答案 0 :(得分:3)
可能你可以试试bootstrap carousel与modal结合
body {
padding-top: 20px;
}
.btn-default {
top: 25%;
left:25%;
color: #999;
background: #fffccc;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container text-center">
<h1> Click Me </h1>
<!-- Large modal -->
<button class="btn btn-default" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img class="img-responsive" src="http://placehold.it/1200x600/555/000&text=One" alt="...">
<div class="carousel-caption">
One Image
</div>
</div>
<div class="item">
<img class="img-responsive" src="http://placehold.it/1200x600/fffccc/000&text=Two" alt="...">
<div class="carousel-caption">
Another Image
</div>
</div>
<div class="item">
<img class="img-responsive" src="http://placehold.it/1200x600/fcf00c/000&text=Three" alt="...">
<div class="carousel-caption">
Another Image
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</div>