我的Bootstrap Photo Carousel不起作用

时间:2013-10-02 21:07:38

标签: css twitter-bootstrap

我是Bootstrap的新手,我想用它为投资组合项目设置一个简单的照片轮播。我希望能够在照片轮播中左右导航,并为我的图像读取字幕。

我遵循了Bootstrap 2.0的Lynda教程并对Bootstrap如何工作有所了解,但我仍然陷入困境。

我的投资组合页面的代码显示左侧的所有三个图像,但它不允许我导航。

我正在使用Bootstrap 3.0。我理解这个版本的类有些不同,但我认为轮播类是相同的。

感谢您的帮助

这是我的代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Design</title>

<link href="css/bootstrap.css" rel="stylesheet" media="screen">
<link href="css/Custom.css" rel="stylesheet" type="text/css">


<script src="http://code.jquery.com/jquery-latesst.js"></script> <!- downloads latest version of jquery --!> 
<script src="js/bootstrap.min.js"></script>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>

</head>
<body>


<div class="carousel slide" id="artists">
        <div class="carousel-inner">

            <div class="item active">
                <img src="img/content writing.jpg"  class="active" alt="content writing"/>
                <div class="carousel-caption>
                    <h2>first item</h2>
                    <p> para text 1</p>
                </div>
            </div>

            <div class="item>    
                <img src="img/Headshot.jpg"  alt="headshot"/>
                <div class="carousel-caption">
                     <h4>second item</h4>
                    <p> para text 2</p>
                </div>
            </div>

            <div class="item"> 
                <img src="img/folder.gif"  alt="social media"/>
                <div class="carousel-caption">
                    <h4>third item</h4>
                    <p> para text 3</p>
                </div>
            </div>

        </div>

    <div class="carousel-control">
    </div>
</div>

<a href="#artists" class="left carousel-control" data-slide="prev">previous
<span class="icon-prev"></span></a>
<a href="#artists" class="right carousel-control" data-slide="next">next</a>
<span class="icon-next"></span></a>


</body>
</html>

1 个答案:

答案 0 :(得分:2)

看起来你只是缺少一些收尾报价,但是我们正在清理这里的是一个稍微更正确的实现(我清理了导航)(demo)。

<div class="carousel slide" id="artists">
  <div class="carousel-inner">
    <div class="item active">
      <img src="http://placecage.com/200/300"  class="active" alt="content writing"/>
      <div class="carousel-caption">
        <h2>first item</h2>
        <p> para text 1</p>
      </div>
    </div>
    <div class="item">    
      <img src="http://placecage.com/g/200/300"  alt="headshot"/>
      <div class="carousel-caption">
        <h4>second item</h4>
        <p> para text 2</p>
      </div>
    </div>
    <div class="item"> 
      <img src="http://placecage.com/c/200/300"  alt="social media"/>
      <div class="carousel-caption">
        <h4>third item</h4>
        <p> para text 3</p>
      </div>
    </div>
  </div>
  <a href="#artists" class="left carousel-control" data-slide="prev">
    previous
    <span class="icon-prev"></span>
  </a>
  <a href="#artists" class="right carousel-control" data-slide="next">
    next
    <span class="icon-next"></span>
  </a>
</div>