2014-08-28 115 views
1

HTML代碼圖像滑塊彈出不工作?

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

    <title>Mini Slider</title> 

    <script type="text/javascript" src="./min_slider_files/jquery-1.9.1.js"></script> 


    <link rel="stylesheet" type="text/css" href="./min_slider_files/bootstrap.css"> 


    <script type="text/javascript" src="./min_slider_files/bootstrap-carousel.js"></script> 


</head> 
<body> 
    <div id="myCarousel" class="carousel slide" style="width: 400px; margin: 0 auto"> 
    <div class="carousel-inner"> 
    <div class="item"> 
     <img src="./min_slider_files/bootstrap-mdo-sfmoma-01.jpg" alt=""> 
     <div class="carousel-caption"> 
     <h4>First Thumbnail label</h4> 

     <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id 
      elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies 
      vehicula ut id elit.</p> 
     </div> 
    </div> 
    <div class="item"> 
     <img src="./min_slider_files/bootstrap-mdo-sfmoma-02.jpg" alt=""> 
     <div class="carousel-caption"> 
     <h4>Second Thumbnail label</h4> 

     <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id 
      elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies 
      vehicula ut id elit.</p> 
     </div> 
    </div> 
    <div class="item active"> 
     <img src="./min_slider_files/bootstrap-mdo-sfmoma-03.jpg" alt=""> 
     <div class="carousel-caption"> 
     <h4>Third Thumbnail label</h4> 

     <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id 
      elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies 
      vehicula ut id elit.</p> 
     </div> 
    </div> 
    </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a> 

    <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a> 
</div> 

我創建使用引導圖像的微型滑塊。

我試圖表明每個圖像的彈出,同時點擊它...

小提琴http://jsfiddle.net/salmanamaan24/Et4pc/281/

+0

哪裏是你的js腳本?我只是在你的小提琴中看到HTML ... – pbenard 2014-08-28 09:05:02

+1

@TheLittlePig我已經使用bootstrap ..你可以看到引導頭內的JavaScript(bootstrap_carousel.js)鏈接.. – User2413 2014-08-28 09:06:49

+0

我談論你試圖打開圖片的腳本莫塔爾,不是旋轉木馬... – pbenard 2014-08-28 09:08:29

回答

0

Bootplyhttp://www.bootply.com/byUX0u7K0s

CSS

.modal-body img{ 
    width:100%; 
    height:100%; 
    } 

JS

$('img').click(function(){ 
    $('.modal-body').html( $(this).parent().html()); 
    $('#myModal').modal({show:true}) 
}); 

HTML

<div id="myCarousel" class="carousel slide" style="width: 400px; margin: 0 auto"> 
    <div class="carousel-inner"> 
    <div class="item"> 
     <img src="http://jasny.github.com/bootstrap/2.3.1/assets/img/bootstrap-mdo-sfmoma-01.jpg" alt=""> 

    </div> 
    <div class="item"> 
     <img src="http://jasny.github.com/bootstrap/2.3.1/assets/img/bootstrap-mdo-sfmoma-02.jpg" alt=""> 

    </div> 
    <div class="item active"> 
     <img src="http://jasny.github.com/bootstrap/2.3.1/assets/img/bootstrap-mdo-sfmoma-03.jpg" alt=""> 

    </div> 
    </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a> 

    <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a> 
</div> 



<div id="myModal" class="modal fade" tabindex="-1" role="dialog"> 
<div class="modal-dialog"> 
    <div class="modal-content"> 
     <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal">×</button> 
      <h3>Modal header</h3> 
    </div> 
    <div class="modal-body"> 
    </div> 
    <div class="modal-footer"> 
     <button class="btn" data-dismiss="modal">Close</button> 
    </div> 
    </div> 
</div> 
</div> 
+0

非常感謝..這就是我想要的.. – User2413 2014-08-28 09:16:39