swiper 幻灯片

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>swiper全屏响应式幻灯片代码</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

<link rel="stylesheet" href="static/css/swiper.min.css">
<style>
* {
	padding: 0;
	margin: 0;
}
	body{background-color: #252525}
.clearfix:after {
	visibility: hidden;
	display: block;
	content: "";
	height: 0;
	line-height: 0;
	clear: both;
}
.clearfix {
	zoom: 1;
}
html, body {
	position: relative;
	height: 100%;
}
body {
	font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
	font-size: 14px;
	color: #000;
	margin: 0;
	padding: 0;
}
.swiper-container {
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}
.gallery-top {
	padding-bottom: 12px;
	width: 100%;
}
.gallery-top .swiper-slide {
	max-width: 100%;
	max-width: 100%;
	width: auto;
	overflow: hidden;
	opacity: 0.5;
}
.gallery-top .swiper-slide img {
	max-width: 100%;
	height: 100%;
}
.gallery-top .swiper-slide-active {
	opacity: 1;
}
.gallery-thumbs {
	height: 65px;
	box-sizing: border-box;
	padding-top: 2px;
}
.gallery-thumbs .swiper-slide {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: 100%;
	overflow: hidden;
}
.gallery-thumbs .swiper-slide img {
	max-width: 100%;
	height: 100%;
}
.gallery-thumbs-box {
	position: relative;
	width: 100%;
	height: 65px;
}
.gallery-thumbs-box .swiper-container {
	margin-left: auto;
	margin-right: auto;
}
.gallery-thumbs-box .swiper-button-prev {
	background-image: url(static/images/left-small.png);
	width: 10px;
	height: 65px;
	background-size: 10px 18px;
	left: 10px;
	margin-top: 0;
	top: 0;
	outline: none;
}
.gallery-thumbs-box .swiper-button-next {
	background-image: url(static/images/next-small.png);
	width: 10px;
	height: 65px;
	background-size: 10px 18px;
	right: 10px;
	margin-top: 0;
	top: 0;
	outline: none;
}
.gallery-top-box {
	position: relative;
	width: 100%;
}
.gallery-top-box .swiper-container {
	margin-left: auto;
	margin-right: auto;
}
.gallery-top-box .swiper-button-prev {
	background-image: url(static/images/left-lg.png);
	width: 18px;
	background-size: 18px 38px;
	left: 10px;
	margin-top: 0;
	top: 50%;
	outline: none;
	transform: translate(0, -50%)
}
.gallery-top-box .swiper-button-next {
	background-image: url(static/images/next-lg.png);
	width: 18px;
	background-size: 18px 38px;
	right: 10px;
	margin-top: 0;
	top: 50%;
	outline: none;
	transform: translate(0, -50%)
}
.slideshow {
	float: right;
	margin-right: 30px;
	margin-top: 15px;
	display: inline-block;
	background-repeat: no-repeat;
	background-position: center right;
	background-image: url("static/images/play.png");
	cursor: pointer;
	padding-right: 15px;
	color: #999;
	transition: all 0.3s ease
}
.pauseed {
	background-image: url("static/images/pause.png");
}
.inner_img_area:hover img{
    transform: scale(1.2);
}
.inner_img_area img{
    width: 100%;
    transition: .5s;
}
</style>

</head>
<body >



<!-- Swiper -->
<div class="inner_img_area">
	<div class="gallery-top-box">
		<div class="swiper-container gallery-top">
			<div class="swiper-wrapper">
				<div class="swiper-slide" data-id="1"> <img src="static/images/a1.png"> </div>
				<div class="swiper-slide" data-id="2"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="3"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="4"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="5"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="6"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="7"> <img src="static/images/a1.png"> </div>
				<div class="swiper-slide" data-id="8"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="9"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="10"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="11"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="12"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="13"> <img src="static/images/a1.png" > </div>
				<div class="swiper-slide" data-id="14"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="15"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="16"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="17"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="18"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="19"> <img src="static/images/a1.png" > </div>
				<div class="swiper-slide" data-id="20"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="21"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="22"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="23"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="24"> <img src="static/images/a6.png"> </div>
			</div>
			<div class="swiper-scrollbar"></div>
		</div>
		<div class="swiper-button-prev"></div>
		<div class="swiper-button-next"></div>
	</div>
	<div class="gallery-thumbs-box">
		<div class="swiper-container gallery-thumbs">
			<div class="swiper-wrapper">
				<div class="swiper-slide" data-id="1"> <img src="static/images/a1.png"> </div>
				<div class="swiper-slide" data-id="2"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="3"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="4"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="5"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="6"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="7"> <img src="static/images/a1.png"> </div>
				<div class="swiper-slide" data-id="8"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="9"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="10"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="11"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="12"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="13"> <img src="static/images/a1.png" > </div>
				<div class="swiper-slide" data-id="14"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="15"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="16"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="17"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="18"> <img src="static/images/a6.png"> </div>
				<div class="swiper-slide" data-id="19"> <img src="static/images/a1.png" > </div>
				<div class="swiper-slide" data-id="20"> <img src="static/images/a2.png"> </div>
				<div class="swiper-slide" data-id="21"> <img src="static/images/a3.png"> </div>
				<div class="swiper-slide" data-id="22"> <img src="static/images/a4.png"> </div>
				<div class="swiper-slide" data-id="23"> <img src="static/images/a5.png"> </div>
				<div class="swiper-slide" data-id="24"> <img src="static/images/a6.png"> </div>
			</div>
		</div>
		<div class="swiper-button-prev"></div>
		<div class="swiper-button-next"></div>
	</div>
	<!-- Swiper -->
	<div class="footernav clearfix" style="height:45px;overflow:hidden;">
	  <div class="slideshow">Stop</div>
	</div>
</div>


<!-- Swiper JS --> 
<script src="static/js/jquery.min.js"></script>
<script src="static/js/swiper.min.js"></script> 
<script>
  	//图片等比例
	galleryTopHeight()
	$(window).resize(function(){
		galleryTopHeight()
	})
	
    var galleryTop = new Swiper('.gallery-top-box .gallery-top', {
	  centeredSlides: true,
	  autoplay:{
		delay:4000,
		disableOnInteraction: false 
	  },
	  slidesPerView: 'auto',
      spaceBetween: 10,
      navigation: {
        nextEl: '.gallery-top-box .swiper-button-next',
        prevEl: '.gallery-top-box .swiper-button-prev',
      },
	  scrollbar: {
        el: '.swiper-scrollbar',
        hide: false,
		draggable: true,
		dragSize:150,
      }
    });
	
	$(".slideshow").click(function(){
		if($(this).hasClass("pauseed")){
			//播放
			$(this).removeClass("pauseed")
			galleryTop.autoplay.start()
		}else{
			//暂停
			$(this).addClass("pauseed")
			galleryTop.autoplay.stop()
			
		}
	})
	
	galleryTop.scrollbar.$el.css({
		"bottom":"0px",
		"background":"none",
		"height":"5px"
	});
	galleryTop.scrollbar.$dragEl.css({
		'background':'rgba(171,171,171,171.6)'
	}); 
	galleryTop.scrollbar.updateSize();
	
    var galleryThumbs = new Swiper('.gallery-thumbs-box .gallery-thumbs', {
      spaceBetween: 10,
      slidesPerView: 'auto',
      touchRatio: 0.2,
	  navigation: {
        nextEl: '.gallery-thumbs-box .swiper-button-next',
        prevEl: '.gallery-thumbs-box .swiper-button-prev',
      }
    });
	
	galleryTop.controller.control = galleryThumbs;
	
	<!--注意添加objThumbs,objTop对应的索引值1 ~ N -->
	var objThumbs = $(".gallery-thumbs .swiper-wrapper .swiper-slide");
	var objTop = $(".gallery-top .swiper-wrapper .swiper-slide");
	objThumbs.click(function(e){
		var currentId = $(this).attr("data-id");
		for(var i = 0 ; i< objTop.length; i++){
			if($(objTop[i]).attr("data-id") === currentId){
				$(objTop[i-1]).addClass("swiper-slide-prev")
				$(objTop[i-1]).siblings().removeClass("swiper-slide-prev")
				$(objTop[i]).addClass("swiper-slide-active")
				$(objTop[i]).siblings().removeClass("swiper-slide-active")
				$(objTop[i+1]).addClass("swiper-slide-next")
				$(objTop[i+1]).siblings().removeClass("swiper-slide-next")
				e.preventDefault();
				galleryTop.slideTo(i,1000, false);
			}
		}
	})
	
	function galleryTopHeight(){
		//处理图片比例
		var wh = $(window).height();
		var headernav_height = $(".headernav").height()
		var footernav_height = $(".footernav").height()
		var galleryThumbs_height = $(".gallery-thumbs").height()
		var galleryTop_height = wh - galleryThumbs_height - headernav_height - footernav_height - 22
		$(".gallery-top").css("height",galleryTop_height)
		//缩略图
		var galleryThumbs_width = $(window).width() - 60
		$(".gallery-thumbs-box .swiper-container").css("width",galleryThumbs_width)
		//大图
		var galleryTop_width = $(window).width() - 80
		$(".gallery-top-box .swiper-container").css("width",galleryTop_width)
	}

</script>

</body>
</html>

源码包swiper幻灯片

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/739167.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

reflutter工具实践之--xx一番赏app

此文章已经录制b站视频&#xff1a; flutter逆向案例-某某一番赏_哔哩哔哩_bilibili 一、工具介绍--reFlutter 这个框架帮助 Flutter 应用逆向工程&#xff0c;使用 Flutter 库的补丁版本&#xff0c;该版本已经编译并准备好重新打包应用。此库修改了快照反序列化过程&#…

Nature推荐的三种ChatGPT论文写作指令

1. 润色学术论文 ChatGPT学术润色指令&#xff1a; “I’m writing a paper on [topic]for a leading [discipline] academic journal. WhatItried to say in the following section is [specific point]. Please rephrase itfor clarity, coherence and conciseness, ensuri…

【源码】最新源支付系统源码 V7版全开源 免授权 附搭建教程

最新源支付系统源码_V7版全开源_免授权_附详细搭建教程_站长亲测 YPay是专为个人站长打造的聚合免签系统&#xff0c;拥有卓越的性能和丰富的功能。它采用全新轻量化的界面UI&#xff0c;让您能更方便快捷地解决知识付费和运营赞助的难题。同时&#xff0c;它基于高性能的thin…

【数据结构与算法】拓扑排序,关键活动,关键路径 详解

拓扑排序算法 bool topologicalSort() {stack<int> stk;int id[N];int cnt 0;for (int i 1; i < n; i) {if (!inDeg[i]) {stk.push(i);}id[i] inDeg[i];}while (stk.size()) {int t stk.top();stk.pop();cout << t << " ";cnt;for (auto i…

Java智慧工地源码 5G智慧工地系统源码 使用SAAS部署 三维可视化管理,与一线生产过程相融合,集成数据后台,统一前端入口,呈现多方项目信息;

Java智慧工地源码 5G智慧工地系统源码 使用SAAS部署 三维可视化管理&#xff0c;与一线生产过程相融合&#xff0c;集成数据后台&#xff0c;统一前端入口&#xff0c;呈现多方项目信息; 智慧工地是指运用信息化手段&#xff0c;通过三维设计平台对工程项目进行精确设计和施工…

【计划】软件项目总体计划书(项目必备资料合集原件)

项目开发计划包括项目描述、项目组织、成本预算、人力资源估算、设备资源计划、沟通计划、采购计划、风险计划、项目过程定义及项目的进度安排和里程碑、质量计划、数据管理计划、度量和分析计划、监控计划和培训计划等。 软件全套精华资料包清单部分文件列表&#xff1a; 工作…

智慧环保一体化平台登录

据悉&#xff0c;在当今这个数字化、智能化的时代&#xff0c;环境保护工作也需要与时俱进&#xff0c;不断创新。朗观视觉智慧环保一体化平台应运而生&#xff0c;它利用先进的信息技术手段&#xff0c;为环保工作提供了更加便捷、高效的管理方式&#xff0c;成为推动绿色发展…

移动端 UI 风格,诠释精致

移动端 UI 风格&#xff0c;诠释精致

【C++】————类和对象(上)

作者主页&#xff1a; 作者主页 本篇博客专栏&#xff1a;C 创作时间 &#xff1a;2024年6月21日 一、类与对象的初步认识 1、类其实就是对对象的抽象&#xff0c;而对象就是对类的具体实例 类不占用内存&#xff0c;而对象占用内存。 2、面向对象与面向过程 C语言是面…

大语言模型(LLMs)能够进行推理和规划吗?

大语言模型&#xff08;LLMs&#xff09;&#xff0c;基本上是经过强化训练的 n-gram 模型&#xff0c;它们在网络规模的语言语料库&#xff08;实际上&#xff0c;可以说是我们文明的知识库&#xff09;上进行了训练&#xff0c;展现出了一种超乎预期的语言行为&#xff0c;引…

GMP合规下的纯蒸汽检查要点:三项值检测及冷凝水取样

制药企业进行纯蒸汽质量验证主要目的&#xff1a; 其一&#xff0c;为了确保药品生产过程的合规性&#xff0c;遵循GMP及国内外法规标准&#xff0c;验证纯蒸汽质量是关键环节。 其二&#xff0c;纯蒸汽质量直接影响药品的纯净度和安全性&#xff0c;验证工作能保障药品的质量…

双指针算法——滑动窗口

前言&#xff1a; 滑动窗口本质上也是利用双指针来解决特定情况下的问题。滑动窗口算法思想是通过俩个指针&#xff0c;定义在左边和右边&#xff0c;俩指针同向运动&#xff0c;保持着一个像“窗口”一样的双指针来不停的压缩或者扩展来移动“窗口”&#xff0c;从而找到特定…

基于Java医院药品交易系统详细设计和实现(源码+LW+调试文档+讲解等)

&#x1f497;博主介绍&#xff1a;✌全网粉丝10W,CSDN作者、博客专家、全栈领域优质创作者&#xff0c;博客之星、平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌&#x1f497; &#x1f31f;文末获取源码数据库&#x1f31f; 感兴趣的可以先收藏起来&#xff0c;…

LeetCode11. 盛最多水的容器题解

LeetCode11. 盛最多水的容器题解 题目链接&#xff1a; https://leetcode.cn/problems/container-with-most-water 示例 思路 暴力解法 定住一个柱子不动&#xff0c;然后用其他柱子与其围住面积&#xff0c;取最大值。 代码如下&#xff1a; public int maxArea1(int[]…

vue3 运用高德地图 自定义弹框 为信息窗体 添加 new AMaps.value.InfoWindow 添加事件

效果图 划过散点的时候出现每个三点位置的数据提示 点击具体散点获取展示信息弹框&#xff0c;并为其添加点击事件 注意点&#xff1a; 1 即使是用的vue&#xff0c;也不能使用click为窗体添加点击事件&#xff0c;需要使用onclick&#xff0c; &#xff08;原因&#xff1a…

PPO代码理解

目录 # Finding the ratio (pi_theta / pi_theta__old): ratios torch.exp(logprobs - old_logprobs.detach()) advantages rewards - state_values.detach() surr1 ratios * advantages surr2 torch.clamp(ratios, 1-self.eps_clip, 1self.eps_clip) * advantages l…

农业四情监测设备——提高农业生产的效率和质量

TH-Q1农业四情监测设备是用于实时监测农业领域的四大关键监测内容的设备&#xff0c;这些内容包括土壤墒情、苗情、病虫情和灾情。以下是关于农业四情监测设备的详细介绍&#xff1a; 主要用于实时测量农田土壤的水分状况。包含土壤湿度传感器、土壤温度传感器等&#xff0c;安…

获取打包后jar包内resource文件路径

Exception:java.lang.IllegalArgumentException: URI is not hierarchical 出现这个异常有很多原因&#xff0c;这里只描述一下我所遇到的 这是源代码&#xff0c;这段代码在本地运行是没有问题的&#xff0c;但是打成jar包&#xff0c;拿到linux上运行之后&#xff0c;就会出…

羊大师:拒绝心灵内耗:走向高效与平和

在繁忙的生活中&#xff0c;我们时常感到疲惫不堪&#xff0c;仿佛心灵被无形的枷锁束缚&#xff0c;这就是精神内耗。它让我们在思考、决策和行动中犹豫不决&#xff0c;消耗着我们的精力和时间&#xff0c;让我们无法专注于真正重要的事情。然而&#xff0c;我们有能力打破这…

【EverEdit】活用 EverEdit 小技巧

【EverEdit】活用 EverEdit 小技巧 &#xff08;1&#xff09;设置 EverEdit 对比文件文本内容 设置如下图所示&#xff1a; 首先要先打开要对比的文本文件&#xff0c;和对比文件相比&#xff0c;此时打开了至少两个文件&#xff1a; 选择文件比较&#xff1a; &#xff08…