当前位置: 首页 > 工具软件 > FlexSlider > 使用案例 >

利用jquery.flexslider.js插件做banner切换,兼容性好,省时间

刘曾琪
2023-12-01

FlexSlider是一个非常出色的jQuery滑动切换插件,它支持所有主流浏览器,并有淡入淡出效果。FlexSlider对于网站开发者来说是一个不错测JQUERY特效,下载链接http://www.ijquery.cn/js/flexslider/jquery.flexslider.js ,例子预览http://www.ijquery.cn/demo/flexslider 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>利用插件做好滚动banner</title>
<link rel="stylesheet" type="text/css" href="css/base.css">
<style type="text/css" media="screen">
/*lunbo*/
.flexslider{position:relative;height:420px;overflow:hidden;background:url(images/loading.gif) 50% no-repeat;}
.slides{position:relative;z-index:1;}
.slides li{height:420px;}
.flex-control-nav{position:absolute;bottom:10px;z-index:2;width:100%;text-align:center;}
.flex-control-nav li{display:inline-block;width:14px;height:14px;margin:0 5px;*display:inline;zoom:1;}
.flex-control-nav a{display:inline-block;width:14px;height:14px;line-height:40px;overflow:hidden;background:url(images/dot.png) right 0 no-repeat;cursor:pointer;}
.flex-control-nav .flex-active{background-position:0 0;}
.flex-direction-nav{position:absolute;z-index:19;width:100%;top:45%;}
.flex-direction-nav li a{display:block;width:50px;height:50px;overflow:hidden;cursor:pointer;position:absolute;}
.flex-direction-nav li a.flex-prev{left:40px;background:url(images/prev.png) center center no-repeat;}
.flex-direction-nav li a.flex-next{right:40px;background:url(images/next.png) center center no-repeat;}
</style>
</head>
<body>
<!-- lunbo -->
<div class="flexslider">
<ul class="slides">
<li style="background:url(images/banner1.jpg) 50% 0 no-repeat;cursor:pointer"></li>
<li style="background:url(images/banner2.jpg) 50% 0 no-repeat;cursor:pointer"></li>
<li style="background:url(images/banner3.jpg) 50% 0 no-repeat;cursor:pointer"></li>
</ul>
</div>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery.flexslider-min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.flexslider').flexslider({
directionNav: true,
pauseOnAction: false
});
});
</script>
</body>
</html>

转载于:https://www.cnblogs.com/may-13/p/6944618.html

 类似资料: