1 <h2>建立模態框(Modal)</h2> 2 <!-- 按鈕觸發模態框 --> 3 <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">開始演示模態框</button> 4 <!-- 模態框(Modal) --> 5 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 6 <div class="modal-dialog"> 7 <div class="modal-content"> 8 <div class="modal-header"> 9 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 10 <h4 class="modal-title" id="myModalLabel">模態框(Modal)標題</h4> 11 </div> 12 <div class="modal-body">在這裏添加一些文本</div> 13 <div class="modal-footer"> 14 <button type="button" class="btn btn-default" data-dismiss="modal">關閉</button> 15 <button type="button" class="btn btn-primary">提交更改</button> 16 </div> 17 </div><!-- /.modal-content --> 18 </div><!-- /.modal --> 19 </div>
1 <div id="myCarousel" class="carousel slide"> 2 <!-- 輪播(Carousel)指標 --> 3 <ol class="carousel-indicators"> 4 <li data-target="#myCarousel" data-slide-to="0" 5 class="active"></li> 6 <li data-target="#myCarousel" data-slide-to="1"></li> 7 <li data-target="#myCarousel" data-slide-to="2"></li> 8 </ol> 9 <!-- 輪播(Carousel)項目 --> 10 <div class="carousel-inner"> 11 <div class="item active"> 12 <img src="/wp-content/uploads/2014/07/slide1.png" alt="First slide"> 13 </div> 14 <div class="item"> 15 <img src="/wp-content/uploads/2014/07/slide2.png" alt="Second slide"> 16 </div> 17 <div class="item"> 18 <img src="/wp-content/uploads/2014/07/slide3.png" alt="Third slide"> 19 </div> 20 </div> 21 <!-- 輪播(Carousel)導航 --> 22 <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> 23 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 24 <span class="sr-only">Previous</span> 25 </a> 26 <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> 27 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 28 <span class="sr-only">Next</span> 29 </a> 30 <!-- 控制按鈕 --> 31 <div style="text-align:center;"> 32 <input type="button" class="btn start-slide" value="Start"> 33 <input type="button" class="btn pause-slide" value="Pause"> 34 <input type="button" class="btn prev-slide" value="Previous Slide"> 35 <input type="button" class="btn next-slide" value="Next Slide"> 36 <input type="button" class="btn slide-one" value="Slide 1"> 37 <input type="button" class="btn slide-two" value="Slide 2"> 38 <input type="button" class="btn slide-three" value="Slide 3"> 39 </div> 40 </div> 41 <script> 42 $(function(){ 43 // 初始化輪播 44 $(".start-slide").click(function(){ 45 $("#myCarousel").carousel('cycle'); 46 }); 47 // 中止輪播 48 $(".pause-slide").click(function(){ 49 $("#myCarousel").carousel('pause'); 50 }); 51 // 循環輪播到上一個項目 52 $(".prev-slide").click(function(){ 53 $("#myCarousel").carousel('prev'); 54 }); 55 // 循環輪播到下一個項目 56 $(".next-slide").click(function(){ 57 $("#myCarousel").carousel('next'); 58 }); 59 // 循環輪播到某個特定的幀 60 $(".slide-one").click(function(){ 61 $("#myCarousel").carousel(0); 62 }); 63 $(".slide-two").click(function(){ 64 $("#myCarousel").carousel(1); 65 }); 66 $(".slide-three").click(function(){ 67 $("#myCarousel").carousel(2); 68 }); 69 }); 70 </script>