jq轮播图
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>轮番图</title>
<style>
*{
padding:0;
margin:0;
}
.box{
width:700px;
height:500px;
margin:80px auto;
border:1px solid red;
position: relative;
}
ul{
list-style: none;
}
div ul.pic li img{
width:700px;
height: 500px;
}
.box ul.pic li{
position:absolute;
display: none;
}
div.box ul.point {
width:135px; /*15*5+10*5+1*10*/
height:22px;
position: absolute;
left:50%;
bottom:20px;
margin-left:-72px;
}
div ul.point li{
width:15px;
height:15px;
border-radius: 50%;
border:1px solid purple;
float:left;
margin:5px;
}
.left{
position:absolute;
left:0;
top:50%;
}
.right{
position:absolute;
right:0;
top:50%;
}
.box .ear li{
width:30px;
height: 30px;
line-height: 30px;
text-align: center;
font-size: 18px;
font-weight: bold;
margin-top:-15px;
position:absolute;
}
/*.box .pic li.show{*/
/*display:block;}*/
.point li.shows{
background-color: red;
}
</style>
</head>
<body>
<div class="box">
<ul class="pic">
<li ><img src="http://img.ivsky.com/img/bizhi/pre/201512/20/huge-005.jpg" ></li>
<li ><img src="http://img.ivsky.com/img/bizhi/pre/201512/20/huge.jpg"></li>
<li ><img src="http://img.ivsky.com/img/bizhi/pre/201512/20/huge-001.jpg"></li>
<li ><img src="http://img.ivsky.com/img/bizhi/pre/201512/20/huge-002.jpg"></li>
<li ><img src="http://img.ivsky.com/img/bizhi/pre/201512/20/huge-004.jpg"></li>
</ul>
<ul class="point">
<li ></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="ear">
<li class="left"><</li>
<li class="right">></li>
</ul>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script>
var $opoi = $("div ul.point li"); //五个圆圈
var $opic = $("div.box ul.pic li"); //五张图
var $btn = $("div ul.ear li"); //两个小耳朵
var len = $opic.length;
// alert(len);
var first = 0;
$opic.eq(first).show();
$opoi.eq(first).addClass("shows");
$opoi.on("click",function(){ //控制小圆圈
var i = $(this).index();
if (i !== first){
change(i);
}
});
$btn.on("click",function () { //控制左右两个小耳朵
var i = first;
if($(this).index() == 0){
i--;
i %= len;
}
else{
i++;
i %= len;
}
change(i);
});
function change(i) {
$opic.eq(first).fadeOut(500);
$opoi.eq(first).removeClass("shows");
first = i;
$opic.eq(i).fadeIn(500);
$opoi.eq(i).addClass("shows");
}
timer = setInterval(function () { //设置定时器
$opic.eq(first).fadeOut(500);
$opoi.eq(first).removeClass("shows");
var i = (first+1)%len;
first = i;
$opic.eq(i).fadeIn(500);
$opoi.eq(i).addClass("shows");
},1000)
</script>
</div>
</body>
</html>

jq轮播图的更多相关文章
- jq轮播图插件
/* * 使用说明 * * 1:需要提供一个标签 * 2:lis:图片的个数 * 3:轮播图的大小 width ,height * 4:图片的地址imgs[0].carou ...
- jq 轮播图
<style> #focus{width:500px;height:200px;overflow:hidden;/*用一个div把图片包含设置超出范围隐藏*/} </style> ...
- jq轮播图插件—手写
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" ...
- jq 轮播图 上下自动滚动
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jq 轮播图 转载-周菜菜
<style> li{list-style-type:none ; display:inline; width:90px; height:160px; float:left; } .pic ...
- jq轮播图实现
html基本框架如下: <div class="out"> <ul class="img"> <li><a href= ...
- jq demo 轮播图,图片可调用,向左,自动+鼠标点击切换
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content ...
- jq demo 轮播图,图片可调用,向上,自动+鼠标点击切换
1 <!doctype html> <html> <head> <meta http-equiv="Content-Type" conte ...
- 用原生的javascript 实现一个无限滚动的轮播图
说一下思路:和我上一篇博客中用JQ去写的轮播图有相同点和不同点 相同点: 首先页面布局是一样的 同样是改变.inner盒子的位置去显示不同的图片 不同点: 为了实现无限滚动需要多添加两张重复的图片 左 ...
随机推荐
- 使用TestNG-xslt美化测试报告
用TestNG测试后,自动会生成html的测试报告,不过相信大家都有感觉,自动生成的测试报告太难看了,所以我们又用了ReportNG来美化它.在 这里给大家再介绍一下比reportNG还要稍稍美观一点 ...
- springboot关闭whitelabel Error page
当访问不存在的页面时报错: 如何关闭它?有2种方法, 方法1: application.properties中加入server.error.whitelabel.enabled=false 方法2:在 ...
- zTree的学习
最近要做一个有关权限的东西,原理和数据库都已经知道了,就是树状图困难. 原先是打算用layui的,因为我孤陋寡闻……吃了大亏,弄了3个小时,屁都没有.只能说是…… 后来百度找到了zTree,进去学习了 ...
- ROS2学习日志:QoS学习日志
QoS学习日志 参考:ROS2API 及 https://index.ros.org/doc/ros2/Concepts/About-Quality-of-Service-Settings 1.概述 ...
- php base64编码图片上传七牛
上网上找了好几个例子 都是自己写curl上传 感觉七牛这么多年了不应该sdk不提供一个方法 然后试 试 试 显示put 方式 上传上去 就是个字符串 后来换成文件上传方法 putFile 成了 不废话 ...
- centos 7.4 安装docker 19.03.6 版本。附带离线安装包
说明: 1.此环境为未安装过docker服务的环境, 如果已经安装,则自行卸载. 2.以下环境中上传的包及离线yum源默认为/home目录下,如无特殊说明,以此目录为准 步骤一:下载docker离线安 ...
- Vmware 部分所学到的功能简写
VMware vSphere Hypervisor 免费版esxi VMware vSphere Update Manager (6.5之后集成到了VCSA中) 在 vSphere 6.5 及更高 ...
- POJ 3911:Internet Service Providers
Internet Service Providers Time Limit: 2MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I ...
- sychronized和lock和区别
syschronized和lock的区别 synchronized的锁可重入.不可中断.非公平,而Lock锁可重入.可中断.可公平.绑定多个Condition.(两者皆可重入)synchronized ...
- .NET CORE 获取微信支付回调
1.获取微信支付的回调的数据 Stream stream = HttpContext.Request.Body; byte[] buffer = new byte[HttpContext.Reques ...