吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 782|回复: 2
收起左侧

[求助] 请求大神 帮我改成轮播图 要用原生js

[复制链接]
wxq666 发表于 2021-10-16 14:58
100吾爱币
HTML代码如下
[HTML] 纯文本查看 复制代码
			<!-- 轮播图 -->
			<div class="row">
				<div class="col-lg-12 col-md-12 col-sm-12">
					<div class="wrap">
						<a href="#" class="arrow-l"> < </a>
						<a href="#" class="arrow-r"> > </a>
						<ul>
							<li>
								<a href="#"> <img src="img/t8.jpg" > </a>
							</li>
						</ul>
						<ol class="circle">
							<li class="on">1</li>
							<li>2</li>
							<li>3</li>
						</ol>
					</div>
				</div>
			</div>



CSS代码如下
[CSS] 纯文本查看 复制代码
.wrap{
	position: relative;
	margin: 30px auto;
	height: auto;
}
.wrap ul{
	height: auto;
}
.wrap ul li a{
	display: block;
}
.wrap ul li a img{
	width: 100%;
}
.arrow-l,
.arrow-r{
	position: absolute;
	top: 50%;
	color: #fff;
	font-size: 18px;
	border: 1px solid #000000;
	padding: 5px;
	background: rgba(0,0,0,.6);
}
.arrow-r{
	right: 0;
}
.circle{
	position: absolute;
	left: 50%;
	bottom: 10px;
}
.circle li{
	float: left;
	width: 15px;
	height: 15px;
	list-style: none;
	line-height: 15px;
	text-align: center;
	border-radius: 50%;
	margin: 0 9px;
	cursor: pointer;
	background: #fff;
}
.circle .on{
	background-color: orange;
}

最佳答案

查看完整内容

好久没写过轮播图了,当练练手,花了一两个小时用的原生js写的,ES6和jQuery都没用 https://wwa.lanzoui.com/iASPCvfaxdc

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lifeixue 发表于 2021-10-16 14:58
好久没写过轮播图了,当练练手,花了一两个小时用的原生js写的,ES6和jQuery都没用
https://wwa.lanzoui.com/iASPCvfaxdc
蓝色魅影 发表于 2021-10-16 21:37
本帖最后由 蓝色魅影 于 2021-10-16 21:39 编辑

授人以鱼不如授人以渔 可以参考下我之前写过的轮播图的一个作业:https://www.aliyundrive.com/s/SMw3BEbwHWx
有几种方式,我这个是JS定时器加改class,还有改位置、改透明度、遮挡的方法等等

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
wxq666 + 1 + 1 热心回复!

查看全部评分

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-29 13:04

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表