2015-09-08 95 views
0

是否有任何解決方案用於響應視圖的引導滑塊圖像拉伸問題?我不想設定高度默認Bootstrap滑塊圖像在響應視圖中拉伸

http://getbootstrap.com/examples/carousel/

我與上面的滑塊,在Twitter的引導給出的默認滑塊嘗試。當我將圖像包含在該滑塊中時,它正在拉伸。如果有人遇到這個問題讓我知道了解決方案

Slider Responsive View - Image Getting Stretched

+0

您可以提供您的實時網址或與我們分享您的代碼? –

+0

我在本地做,抱歉我不知道如何在js小提琴中分享我的代碼。所以我附上了我的響應式視圖快照 – Saran

+0

轉到https://jsfiddle.net/並將代碼分配到各自的部分。在左側,將Bootstrap Css和Js鏈接添加到'External Resources'選項卡。我們更容易調試。 –

回答

1

我不知道你是否已經在尋找這一點,但引導還提供了響應圖像的類。只是將它添加到img標籤。

HTML

<div class="slider"> 
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> 
    <!-- Indicators --> 
    <ol class="carousel-indicators"> 
     <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> 
     <li data-target="#carousel-example-generic" data-slide-to="1"></li> 
     <li data-target="#carousel-example-generic" data-slide-to="2"></li> 
    </ol> 
    <!-- Wrapper for slides --> 
    <div class="carousel-inner"> 
     <div class="item active"> 
     <img src="http://dreamatico.com/data_images/cat/cat-6.jpg" class="img-responsive" alt="Slider 1"> 
     <div class="carousel-caption"> 
     <h3>Caption Text</h3> 
     </div> 
    </div> 
    <div class="item"> 
    <img src="http://dreamatico.com/data_images/cat/cat-6.jpg" class="img-responsive" alt="Slider 2"> 
    <div class="carousel-caption"> 
     <h3>Caption Text</h3> 
    </div> 
    </div> 
    <div class="item"> 
    <img src="http://dreamatico.com/data_images/cat/cat-6.jpg" class="img-responsive" alt="Slider 3"> 
    <div class="carousel-caption"> 
     <h3>Caption Text</h3> 
    </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> <!-- Carousel --> 
</div> 

的JavaScript

$('.carousel').carousel({ 
    interval: 3000 
}) 

看到它也jsfiddle