一、全屏banner

1、设置网页图片全屏banner

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin: 0;
padding: 0;
}
.pic {
width: 100%;
height: 600px;
background: url("...") no-repeat center;
}
</style>
</head>
<body>
<div class="banner">
<div class="pic"></div>
</div>
</body>
</html>

  二、全屏轮播

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>全屏轮播模板</title>
<style>
html,body,head,span,button,div,title {
margin: 0;
padding: 0;
}
.cont {
position: relative;
height: 600px;
}
.list{
position: relative;
}
.list div {
width: 100%;
height: 600px;
position: absolute;
opacity: 0;
transition: 1s; /*设置切换时间*/
}
.pic1 {
background: url(img/lbt01.jpg) no-repeat center red;
}
.pic2 {
background: url(img/lbt02.jpg) no-repeat center blue;
}
.pic3 {
background: url(img/lbt03.jpg) no-repeat center yellow;
}
.pic4 {
background: url(img/lbt04.jpg) no-repeat center green;
}
.pic5 {
background: url(img/lbt05.jpg) no-repeat center pink;
}
.btns {
position: absolute;
z-index: 6;
left: 50%;
bottom: 80px;
margin-left: -170px;
}
.btns span {
float: left;
width: 60px;
height: 5px;
margin-right: 10px;
background-color: rgba(255,255,255,0.3);
border-radius: 5px;
}
.buttons {
width: 1180px;
height: 600px;
margin: 0 auto;
position: relative;
}
.btn { /*左右切换按钮样式*/
position: absolute;
top: 50%;
margin-top: -26px;
width: 32px;
height: 52px;
font-size: 30px;
border-radius: 5px;
z-index: 6;
opacity: 0.5;
}
.btn-prev {
left: 0;
}
.btn-next {
right: 0;
}
.bgc {
background-color: white !important;
}
</style>
</head>
<body>
<div class="cont">
<div class="list">
<div class="pic1" data-index=0 style="opacity: 1; z-index: 2;"></div>
<div class="pic2" data-index=1></div>
<div class="pic3" data-index=2></div>
<div class="pic4" data-index=3></div>
<div class="pic5" data-index=4></div>
</div>
<div class="btns">
<span class="bgc"></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="buttons">
<button class="btn btn-prev"> < </button>
<button class="btn btn-next"> > </button>
</div>
</div> <script>
var btn = document.getElementsByClassName("btn");
var imgs = document.querySelectorAll(".list div");
var btns = document.querySelectorAll(".btns span");
var cont = document.getElementsByClassName("cont")[0];
var indexes, timer = null;
for(let i=0; i<btns.length; i++){
btns[i].onmouseover = function(){ // 给所有下面的白色线条添加一个鼠标经过事件
animate(i);
}
} btn[0].onclick = function(){ // 上一张按钮
indexes = currentPage();
if(indexes == 0) indexes=5;
indexes--;
animate(indexes);
} btn[1].onclick = next; function next(){ // 下一张按钮
indexes = currentPage();
if(indexes == 4) indexes = -1;
indexes++;
animate(indexes);
} function animate(i){ // 动画函数
for(let j = 0; j<imgs.length; j++){
imgs[j].style.opacity = 0;
imgs[j].style.zIndex = 1;
btns[j].classList.remove("bgc");
}
imgs[i].style.opacity = 1;
imgs[i].style.zIndex = 2;
btns[i].classList.add("bgc");
} function currentPage() { // 返回当前页面
for(var i = 0; i<imgs.length; i++){
if(imgs[i].style.zIndex == 2){
return imgs[i].dataset.index;
}
}
} timer = setInterval(next,3000); // 设置自动播放
cont.onmousemove = function(){ // 鼠标移入时停止自动播放
clearInterval(timer);
}
cont.onmouseout = function(){ // 鼠标移出时又开始播放
timer = setInterval(next,3000);
}
</script>
</body>
</html>

  

全屏banner及全屏轮播的更多相关文章

  1. Android--图片轮播(banner)

    使用步骤 Step 1.依赖banner Gradle dependencies{ compile 'com.youth.banner:banner:1.4.10' //最新版本 } 或者引用本地li ...

  2. android 使用图片轮播图---banner 使用

    转自:https://github.com/youth5201314/banner 使用步骤 Step 1.依赖banner Gradle dependencies{ compile 'com.you ...

  3. 029 Android 轮播图广告Banner开源框架使用

    1.Banner介绍 现在的绝大数app都有banner界面,实现循环播放多个广告图片和手动滑动循环等功能. 2.使用环境配置(具体可见github开源项目) (1)添加依赖 在build.gradl ...

  4. Android 开发最牛的图片轮播控件,基本什么都包含了。

    Android图片轮播控件  源码下载地址: Android 图片轮播 现在的绝大数app都有banner界面,实现循环播放多个广告图片和手动滑动循环等功能.因为ViewPager并不支持循环翻页, ...

  5. 图片轮播(淡入淡出)--JS原生和jQuery实现

    图片轮播(淡入淡出)--js原生和jquery实现 图片轮播有很多种方式,这里采用其中的 淡入淡出形式 js原生和jQuery都可以实现,jquery因为封装了很多用法,所以用起来就简单许多,转换成j ...

  6. html渐隐轮播

    这是我之前用的时候从一个模板中下载下来用的,现在又用到了,我又重新找了一遍,为防止我下次用到忘记,特写下此文: 下载插件:jquery-2.1.4.min.js和slider.js 首页轮播页面首页i ...

  7. ViewPager实现无限轮播踩坑记

    最近笔者想通过ViewPager来实现一个广告Banner,并实现无限轮播的效果,但是在这个过程中踩了不少的坑,听我慢慢道来.如果大家有遇到和我一样的情况,可以参考我的解决方法,没有那就更好,如果针对 ...

  8. Android图片轮播控件

    Android广告图片轮播控件,支持无限循环和多种主题,可以灵活设置轮播样式.动画.轮播和切换时间.位置.图片加载框架等! 使用步骤 Step 1.依赖banner Gradle dependenci ...

  9. 第三百七十三节,Django+Xadmin打造上线标准的在线教育平台—创建用户app,在models.py文件生成3张表,用户表、验证码表、轮播图表

    第三百七十三节,Django+Xadmin打造上线标准的在线教育平台—创建用户app,在models.py文件生成3张表,用户表.验证码表.轮播图表 创建Django项目 项目 settings.py ...

随机推荐

  1. java.lang.SecurityException: class "javax.servlet.AsyncContext"'s signer information does not match signer information of other classes in the same package

    最近在写个Http协议的压测挡板时,遇到以下错误. 2018-03-08 10:34:07.808:INFO:oejs.Server:jetty-8.1.9.v20130131 2018-03-08 ...

  2. Java框架之SpringBoot-Web构建-yml-模块-注解

    SpringBoot Spring Boot是一站式整合所有应用框架的框架,简化Spring应用开发,约定大于配置,去繁从简,开箱即用,准生产环境的运行时应用监控框架 快速构建 SpringBoot ...

  3. 进阶之路 | 奇妙的Handler之旅

    前言 本文已经收录到我的Github个人博客,欢迎大佬们光临寒舍: 我的GIthub博客 需要已经具备的知识: Handler的基本概念及使用 学习导图: 一.为什么要学习Handler? 在Andr ...

  4. 如何在普通的元素上实现enter键的绑定

    在做登录页面时候,通常当用户输入账号密码后直接按enter键就触发登录按钮了. 如果是input标签,vue中可以绑定按键修饰符,但是如果是其它标签呢.我的做法如下: document.querySe ...

  5. 大型Java进阶专题(二) 软件架构设计原则(上)

    前言 ​ 今天开始我们专题的第一课了,也是我开始进阶学习的第一天,我们先从经典设计思想开始,看看大牛市如何写代码的,提升技术审美.提高核心竞争力.本章节参考资料书籍<Spring 5核心原理&g ...

  6. Ajax同步和异步的区别?

    今天在code review时候看到同事的代码,用了ajax同步,async:false,如果不设置async参数,默认是true,为异步,异步的情况是比较复杂的,看下同步这个例子: function ...

  7. Lake Counting(POJ No.2386)

    题目描述:有一个大小为N*M的园子,八连通的积水被认为是连接在一起的.请求出园子里总共有多少水洼?(八连通指的是下图中相对w的*部分) *** *w* *** 限制条件 N,M<=100 样例 ...

  8. 基于osg的python三维程序开发(三)------几何形体及纹理

    def createScene(): geode = osg.Geode() pointsGeom = osg.Geometry() vertices = osg.Vec3Array() vertic ...

  9. <字符串匹配>KMP算法为何比暴力求解的时间复杂度更低?

    str表示文本串,m表示模式串; str[i+j] 和 m[j] 是正在进行匹配的字符; KMP的时间复杂度是O(m+n)  ,  暴力求解的时间复杂度是O(m*n) KMP利用了B[0:j]和A[i ...

  10. 在kubernetes1.17.2上结合ceph部署efk

    简绍 应用程序和系统日志可以帮助我们了解集群内部的运行情况,日志对于我们调试问题和监视集群情况也是非常有用的.而且大部分的应用都会有日志记录,对于传统的应用大部分都会写入到本地的日志文件之中.对于容器 ...