BootStrapJS - 轮播

时间:2015-12-07 08:34:11

标签: twitter-bootstrap

我尝试使用Carousel制作图像幻灯片。然而,图片永远不会出现。我怀疑从我的本地电脑连接css,js是个问题。但我所有的尝试都是徒劳的。

<asp:DropDownList ID="ddlDepartment" AutoPostBack="True"  runat="server"  AppendDataBoundItems="True"  BackColor="#F3F3F3" ForeColor="#838383" 
             Height="25px" style="text-align: left"  Width="135px" DataSourceID="SqlDataSourceDepartment" DataTextField="DepartmentName" DataValueField="DepartmentID" OnDataBound="ddlDepartment_DataBound"  >
                <asp:ListItem Value="0">Select Department</asp:ListItem>
</asp:DropDownList>



<asp:DropDownList ID="ddlGroup" runat="server" BackColor="#F3F3F3"  ForeColor="#838383" Height="25px" style="text-align: left; margin-bottom: 0px;" Width="145px" DataSourceID="SqlDataSourceGroup" DataTextField="GroupName" DataValueField="GroupID" AutoPostBack="true" OnDataBound="ddlGroup_DataBound" AppendDataBoundItems="true" > 
              <asp:ListItem>Select Group</asp:ListItem>

请帮助。

我的档案目录

夹      | - bootstrap-3.3.6-dist - css,js,fonts      | - myfirstsite.html      | - 我的所有图片

以下是我得到的输出。documentation

2 个答案:

答案 0 :(得分:1)

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<div class="container">
  <div id="myCarousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img src="http://placehold.it/500x500/#f00" alt="Rhino" class="img-responsive center-block">
      </div>

      <div class="item">
        <img src="http://placehold.it/500x500/#f0f" alt="Elephant" class="img-responsive center-block">
      </div>

      <div class="item">
        <img src="http://placehold.it/500x500/#00f" alt="Tiger" class="img-responsive center-block">
      </div>

      <div class="item">
        <img src="http://placehold.it/500x500/#333" alt="Lion" class="img-responsive center-block">
      </div>
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
  </div>
</div>

  

为什么你在col-xs-12之后在carousel类上给出了这个逗号?   默认情况下,它将是其父级的宽度,您不需要定义col-   宽度那里。

答案 1 :(得分:0)

试试这个:

<div id="myCarousel" class="col-md-12 carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img src="rhino.jpg" alt="Rhino" width="500" height="500">
      </div>

      <div class="item">
        <img src="ele.jpg" alt="Elephant" width="500" height="500">
      </div>

      <div class="item">
        <img src="tiger.jpg" alt="Tiger" width="500" height="500">
      </div>

      <div class="item">
        <img src="lion.jpg" alt="Lion" width="500" height="500">
      </div>
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
  </div>
</div>
</body>
</html>

从类名

中删除逗号