各种轮播实现(纯css实现+js实现)
1.纯Css实现轮播效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{margin:0;padding:0;}
#wrap{
width:520px;height:280px;
border:1px solid;overflow:hidden;
position:absolute;top:100px;left:300px;
}
.box{
width:2600px;height:280px;
position:relative;
z-index:9;
left:0;
cursor:pointer;
}
.box>li{float:left;}
.pics_list{
width:100%;height:8%;
position:absolute;bottom:0px;
background:#8B8878;opacity:0.8;filter:alpha(opacity:80);
cursor:pointer;text-align:center;
z-index:999;
}
.num{
position:absolute;z-index:10;
display:inline-block;
right:10px;bottom:0px;
border-radius:100%;
background:#f00;
width:25px;height:25px;
line-height:25px;
cursor:pointer;
color:#fff;
text-align:center;
opacity:0.8;
margin:0 10px;
} .num:hover{background:#00f;}
.num:nth-child(2){margin-right:40px}
.num:nth-child(3){margin-right:80px}
.num:nth-child(4){margin-right:120px}
.num:nth-child(5){margin-right:160px}
.num:hover,.box:hover{animation-play-state:paused;} .play{
animation: ma 10s ease-out infinite alternate;
} #a1:hover ~ .box{animation: ma1 .5s ease-out forwards;}
#a2:hover ~ .box{animation: ma2 .5s ease-out forwards;}
#a3:hover ~ .box{animation: ma3 .5s ease-out forwards;}
#a4:hover ~ .box{animation: ma4 .5s ease-out forwards;}
#a5:hover ~ .box{animation: ma5 .5s ease-out forwards;}
@keyframes ma1 {0%{left:-1200px;}100%{left:-0px;} }
@keyframes ma2 {0%{left:-1200px;}100%{left:-520px;} }
@keyframes ma3 {100%{left:-1040px;} }
@keyframes ma4 {100%{left:-1560px;} }
@keyframes ma5 {100%{left:-2120px;} } @keyframes ma {/*---每图片切换有两个阶段:位移切换和静置。中间的效果可以任意定制----*/
0%,20% { left: 0px; }
25%,40% { left: -520px; }
45%,60% { left: -1040px; }
65%,80% { left: -1560px; }
85%,100% { left: -2120px; }
}
</style>
</head>
<body>
<div id="wrap">
<a class="num" id="a1"></a>
<a class="num" id="a2"></a>
<a class="num" id="a3"></a>
<a class="num" id="a4"></a>
<a class="num" id="a5"></a>
<ul class="box play">
<li><img src="img/2.jpg" alt="" /></li>
<li><img src="img/1.jpg" alt="" /></li>
<li><img src="img/3.jpg" alt="" /></li>
<li><img src="img/4.jpg" alt="" /></li>
<li><img src="img/5.jpg" alt="" /></li>
</ul>
</div>
</body>
</html>
各种轮播实现(纯css实现+js实现)的更多相关文章
- 纯css、js 的H5页面对接echarts
做项目时,会遇到一些零碎的技术点.记录下来以防忘记 需求:做可视化界面,但是需要兼容ie8,需要用纯css.js 的H5页面对接echarts,下面为效果图(带定时器循环显示tooltip). 实现方 ...
- 纯js轮播图练习-2,js+css旋转木马层叠轮播
基于css3的新属性,加上js的操作,让现在js轮播图花样越来越多. 而现在出现的旋转木马层叠轮播的轮播图样式,却是得到了很多人都喜爱和投入使用. 尤其是在各大软件中,频繁的出现在大家的眼里,在web ...
- 纯css和js版下拉菜单
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- 纯CSS实现JS效果研究
利用CSS3:checked选择器和~配合实现tab切换 效果: 代码: <style> body,div,input,label{ margin:0; padding:0; } #tab ...
- 纯css无js实现点击事件
<input id="A" type="checkbox"><label for="A"> <span cla ...
- 纯js写图片轮播插件
最近终于写成了自己创作的图片轮播插件,使用原生js编写.与目前网上流行的轮播插件相比,功能和效果稍弱,但是使用起来相当方便. 先看html代码 <!DOCTYPE html> <ht ...
- js原生轮播
js原生轮播 今天用js做了轮播图,做的不怎么好,希望大家能够看懂. 效果: 1.鼠标放在轮播图上自动停止 2.鼠标离开轮播图自动播放 3.鼠标点击轮播图上的小圆点跳转到相应的图上. 代码: < ...
- 原生js实现简单轮播的淡入淡出效果
实现这种淡入淡出的轮播关键在于css的一种设置 首先它不能像传统的轮播显示隐藏 或者左右浮动 他应该让其固定定位使其重叠在一起 达到这种效果 然后设置c3动画属性 transition:1s; ...
- 使用原生js将轮播图组件化
代码地址如下:http://www.demodashi.com/demo/11316.html 这是一个轮播图组件,这里是代码地址,需要传入容器的id和图片地址,支持Internet Explor ...
随机推荐
- CSU - 1115 最短的名字(字典树模板题)
Description 在一个奇怪的村子中,很多人的名字都很长,比如aaaaa, bbb and abababab. 名字这么长,叫全名显然起来很不方便.所以村民之间一般只叫名字的前缀.比如叫'aaa ...
- AOJ -0033 Ball(DFS)
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=22516 一道需要思考的搜索题. 题意:十个球按给定顺序从图中所示容器中下落, ...
- [bzoj1510][POI2006]Kra-The Disks_暴力
Kra-The Disks bzoj-1510 POI-2006 题目大意:题目链接. 注释:略. 想法:不难发现其实只有前缀最小值是有效的. 进而我们把盘子一个一个往里放,弄一个自底向上的指针往上蹦 ...
- Ubuntu 16.04安装Memcached(单机)
Ubuntu 16.04安装Memcached,不过不仅限与Ubuntu,可以用CentOS等去安装,只不过测试时使用的是Ubuntu机器.Windows下不建议使用,本机调试可以使用,线上环境除了W ...
- MYSQL 时间数据类型
- C++之类的比較运算符的重载
比較运算符的重载通常有两种方式: 第一:作为成员函数重载 曾经几章的Student类为例: <span style="font-family:Microsoft YaHei;font- ...
- 008 frame relay
Router>en Router#config t Enter configuration commands, one per line. End with CNTL/Z. Router(co ...
- Telnet登入cisco router 1800
Login to Router and change to privileged modec:\>telnet 192.168.6.1Trying 192.168.6.1...Connected ...
- Datagridview CurrentRow.Index
int index = dataGridView1.CurrentRow.Index; //获取当前选择行引导 string str = dataGridView1.Rows[index].Cell ...
- mysql导出整个数据库
mysql导出整个数据库 mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql mysqldump - ...