---
title: "Bootstrap插件--图片轮播"
author: "小丑鱼0703"
date: "2015-03-25T11:05:20Z"
tags: []
categories: ["Web前端"]
slug: "bootstrap"
draft: false
lastmod: "2015-03-24T17:59:51Z"
id: 2195176
url: "https://wangjingyi.iteye.com/blog/2195176"
---

\[url]http://www.bootcss.com/p/unslider/\[/url] 1.首先引入jQuery和Unslider的脚本： \[code="js"] \[/code] 2.准备HTML代码创建如下布局： \[code="html"]

- This is a slide.
- This is another slide.
- This is a final slide.

\[/code] 3.添加样式保证浮动定位准确： \[code="css"] .banner { position: relative; overflow: auto; } .banner li { list-style: none; height：200px;} .banner ul li { float: left; }\[/code] 4.添加事件： \[code="js"] \[/code] 给每个li添加背景图片属性\[code="java"]background-image: url(/img/xx.jpg); background-size: 100% 100%;\[/code]这样就可以用插件轻松实现图片轮播了~ 源码请移步:\[url]https://github.com/idiot/unslider/blob/master/src/unslider.js\[/url]