BootStrap 实现轮播图

Bootstrap中文网 

1、下载BootStrap

2、引入相关文件

在下载好的文件夹中找到下面的文件,复制到自己的项目中并引入

<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />

<script src="bootstrap/js/jquery.min.js"></script>

<script src="bootstrap/js/bootstrap.min.js"></script>

3、查看bootstrap中实现轮播图的插件

Carousel就是轮播图的效果:

复制下面的代码到我们的html页面中 

 <!-- 轮播图模块 -->
    <div class="focus">
        <!-- 下面的是复制的 -->
      <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" role="listbox">
          <div class="item active">
            <img src="..." alt="..." />
            <div class="carousel-caption">...</div>
          </div>
          <div class="item">
            <img src="..." alt="..." />
            <div class="carousel-caption">...</div>
          </div>
          ...
        </div>

        <!-- Controls 控制按钮-->
        <a
          class="left carousel-control"
          href="#carousel-example-generic"
          role="button"
          data-slide="prev"
        >
          <span
            class="glyphicon glyphicon-chevron-left"
            aria-hidden="true"
          ></span>
          <span class="sr-only">Previous</span>
        </a>
        <a
          class="right carousel-control"
          href="#carousel-example-generic"
          role="button"
          data-slide="next"
        >
          <span
            class="glyphicon glyphicon-chevron-right"
            aria-hidden="true"
          ></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
    </div>

添加自己的图片,就可以实现轮播图了。

相关推荐

  1. jQuery实现3D

    2024-01-16 19:14:06       42 阅读
  2. jQuery实现代码

    2024-01-16 19:14:06       44 阅读
  3. Swiper

    2024-01-16 19:14:06       11 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-16 19:14:06       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-16 19:14:06       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-16 19:14:06       20 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-16 19:14:06       20 阅读

热门阅读

  1. GBASE南大通用ExecuteScalar 方法

    2024-01-16 19:14:06       35 阅读
  2. 聊聊PowerJob的QueryConvertUtils

    2024-01-16 19:14:06       34 阅读
  3. liunx常用命令

    2024-01-16 19:14:06       30 阅读
  4. fs 模块

    2024-01-16 19:14:06       34 阅读
  5. 重装系统备份及初始化笔记

    2024-01-16 19:14:06       35 阅读
  6. RSA非对称加密

    2024-01-16 19:14:06       33 阅读
  7. HTML 入门 干货 总结

    2024-01-16 19:14:06       33 阅读
  8. 关于文件上传功能的安全方面的考量

    2024-01-16 19:14:06       31 阅读