一、全屏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. windows下用Python把pdf文件转化为图片

    依赖:PyMuPDF(pip install pymupdf) # -*- coding: utf-8 -*- """ 1.安装库 pip install pymupdf ...

  2. 第一篇:注册中心Eureka

    1.什么是Eureka,有什么用? Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是spri ...

  3. Ado.net01

    ------------恢复内容开始------------ 1.ExcuteReader using System; using System.Data.SqlClient; using Syste ...

  4. Description Resource Path Location Type cvc-complex-type.2.4.c: The matching 解决问题

    2017-03-02 10:08:03,112 [localhost-startStop-1] ERROR org.springframework.web.servlet.DispatcherServ ...

  5. JS基础入门篇(十八)—日期对象

    1.日期对象 日期对象: 通过new Date()就能创建一个日期对象,这个对象中有当前系统时间的所有详细信息. 以下代码可以获取当前时间: <script> var t = new Da ...

  6. Java基础篇(01):基本数据类型,核心点整理

    本文源码:GitHub·点这里 || GitEE·点这里 一.基本类型 1.基本类型 不使用New创建,声明一个非引用传递的变量,且变量的值直接置于堆栈中,大小不随运行环境变化,效率更高.使用new创 ...

  7. 最适合初学者的一篇 Ribbon 教程

    什么是 Ribbon Ribbon 是一个基于 HTTP 和 TCP 的 客服端负载均衡工具,它是基于 Netflix Ribbon 实现的. 它不像 Spring Cloud 服务注册中心.配置中心 ...

  8. Yuchuan_Linux_C 编程之十一 进程间通信

    一.整体大纲 二.进程间通信概念及方法  Linux环境下,进程地址空间相互独立,每个进程各自有不同的用户地址空间.任何一个进程的全局变量在另一个进程中都看不到,所以进程和进程之间不能相互访问,要交换 ...

  9. 聊聊CAS - 面试官最喜欢问的并发编程专题

    什么是CAS 学习Java并发编程,CAS(Compare And Set)机制都是一个不得不掌握的知识点.除了通过synchronized进行并发控制外,还可以通过CAS的方式控制,大家熟悉的Ree ...

  10. 内网渗透之信息收集-Linux系统篇

    linux 系统信息 grep MenTotal /proc/meminfo #查看系统内存总量 cat /etc/issue #查看系统名称 cat /etc/lsb-release #查看系统名称 ...