C罗轮播图(HTML+CSS+JS)

✅作者简介:热爱国学的Java后端开发者,修心和技术同步精进。
🍎个人主页:Java Fans的博客
🍊个人信条:不迁怒,不贰过。小知识,大智慧。
💞当前专栏:前端案例分享专栏
✨特色专栏:国学周更-心性养成之路
🥭本文内容:C罗轮播图(HTML+CSS+JS)
更多内容点击👇
      JS新年倒计时

目录

C罗简介

告别2022世界杯

效果展示

源码分享

投票传送门


C罗简介

克里斯蒂亚诺·罗纳尔多(Cristiano Ronaldo dos Santos Aveiro),简称“C罗”,1985年2月5日出生于葡萄牙马德拉岛丰沙尔,葡萄牙职业足球运动员,司职边锋/中锋。

告别2022世界杯

北京时间 12 月 11 日凌晨,世界杯1/4决赛,葡萄牙0:1不敌摩洛哥,无缘世界杯4强。C罗首度发声,以下是 C罗的长文:

为葡萄牙赢得世界杯冠军是我职业生涯中最大的梦想。幸运的是,我也赢得了很多国际级别的冠军,包括为葡萄牙赢得的冠军,但让我们国家的名字登上世界顶点是我最大的梦想。

我为此而战!为了这个梦想,我努力奋斗!过去16年,我连续5届世界杯进球,总是和伟大的球员们并肩作战,并得到了数百万葡萄牙人的支持,我也付出了自己的全部。我把一切都留在了球场上,我从不会回避战斗,我也从未放弃那个梦想。

不幸的是,昨天梦想结束了。这不值得有太多回应,外界说了很多,写了很多,推测了很多。我只想让每个人知道,我对葡萄牙的奉献从未改变。我永远是一个所有人的梦想而战的人,永远不会背弃我的队友和国家。

最后,没有太多要说的了。谢谢你,葡萄牙。谢谢你,卡塔尔。追逐梦想总是美好的……如今,是时候让我成为一名优秀的向导,去让每个人都能得出自己的结论。

效果展示

这个视屏是做的C罗轮播图的效果展示视屏。

源码分享

完整的代码分享,希望对爱学习的博友来说,是个好素材!

1、HTML代码

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
		<link rel="stylesheet" href="css/cluo.css">
	</head>
	<body>
		<!-- 轮播图整体容器 -->
		<div class="div_Content">
			<!-- 八张轮播图 -->
			<ul class="ul_Lun">
				<li><img src="./img/1.jpg"></li>
				<li><img src="./img/2.jpg"></li>
				<li><img src="./img/3.jpg"></li>
				<li><img src="./img/4.jpg"></li>
				<li><img src="./img/5.jpg"></li>
				<li><img src="./img/6.jpg"></li>
				<li><img src="./img/7.jpg"></li>
				<li><img src="./img/8.jpg"></li>
			</ul>
			<!-- 左右点击按钮 -->
			<div class="div_Buttons">
				<img class="imgBtn1" src="./img/左箭头-选中.png">
				<img class="imgBtn2" src="./img/右箭头-选中.png">
			</div>
			<!-- 左下角八个浮动点 -->
			<div class="div_Points">
				<ul class="ul_Points">
					<li class="liStyle"></li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
					<li class="liStyle"</li>
				</ul>
			</div>
		</div>
		
		<script type="text/javascript" src="js/cluo.js"></script>
	</body>
</html>

2、css代码

			.div_Content {
				position: relative;
				width: 900px;
				height: 600px;
				margin: 100px auto;
			}

			.ul_Lun {
				list-style: none;
			}

			.ul_Lun>li {
				position: absolute;
			}

			.ul_Lun img {
				width: 900px;
				height: 600px;
			}

			.div_Points {
				position: relative;
				z-index: 1;
				float: left;
			}

			.div_Points>ul {
				list-style: none;
				margin-left: -20px;
			}
			.liStyle {
				margin-left: 2px;
				margin-top: 20px;
				width: 8px;
				height: 8px;
				/* background: rgba(255, 255, 255, .4); */
				float: left;
				border-radius: 50%;
				border: 3px solid rgba(0, 0, 0, .05);
			}
			.liStyle:hover{
				width: 8px;
				height: 8px;
				background: rgba(255, 255, 255, 1);
				border: 3px solid rgba(0, 0, 0, .05);
			}

			.pointStyle {
				background: rgba(255, 255, 255, 1);
			}
			.pointOldStyle {
				background: rgba(255, 255, 255, .4);
			}
			.div_Buttons {
				position: relative;
				z-index: 1;
			}

			.imgBtn1 {
				position: relative;
				width: 50px;
				height: 80px;
				float: left;
				left: 40px;
				top: 230px;
				filter: opacity(50%);
			}

			.imgBtn2 {

				position: relative;
				width: 50px;
				height: 80px;
				float: right;
				right: -40px;
				top: 230px;
				filter: opacity(50%);
			}

3、引用外部JavaScript文件:js代码

			var num = 0;
			var flag=true;
			wheelTimes(num);
			var myVar = setInterval(wheelTimes, 2000);
			function wheelTimes() {
				//获取轮播图片ul里的所有li元素;
				var ulEleImg = document.getElementsByClassName('ul_Lun').item(0).children;
				//遍历轮播图片ul,给所有li的zIndex属性初始化层级值为0;
				for (let s of ulEleImg) {
					s.style.zIndex = '0';
				}
				//设置当前的图片的层级为1,从而显示该图片s
				ulEleImg.item(num).style.zIndex = '1';
				
				//获取左下角亮点ul里的所有li元素;
				var ulEle = document.getElementsByClassName('ul_Points').item(0).children;
				console.log(ulEle);
				for (let sUlEle of ulEle) {
					sUlEle.className='liStyle pointOldStyle';
				}
				ulEle.item(num).className = 'liStyle pointStyle';
				if(num==ulEleImg.length-1){
					flag=false;
				}else if(num==0){
					flag=true;
				}
				if(flag){
					num++;
				}else{
					num--;
				}

			}

投票传送门


  码文不易,本篇文章就介绍到这里,如果想要学习更多Java系列知识点击关注博主,博主带你零基础学习Java知识。与此同时,对于日常生活有困扰的朋友,欢迎阅读我的第四栏目《国学周更—心性养成之路》,学习技术的同时,我们也注重了心性的养成。

在这里插入图片描述

 

  • 14
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论
好的,我可以提供一个简单的示例,但这可能远远超过300行。请注意,这只是一个基本的框架,您需要根据自己的需求进行修改和定制。 HTML代码: ```html <!DOCTYPE html> <html> <head> <title>旅游网页</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <div class="container"> <h1>旅游网页</h1> <nav> <ul> <li><a href="#">首页</a></li> <li><a href="#">旅游指南</a></li> <li><a href="#">景点介绍</a></li> <li><a href="#">联系我们</a></li> </ul> </nav> </div> </header> <section id="banner"> <div class="container"> <h2>发现你的理想旅游目的地</h2> <p>探索世界各地的美景和文化</p> <a href="#" class="btn">了解更多</a> </div> </section> <section id="features"> <div class="container"> <h3>我们的旅游服务</h3> <div class="feature"> <img src="img/feature1.jpg"> <h4>行程定制</h4> <p>根据您的需求和预算,我们可以为您设计最佳的旅游行程</p> </div> <div class="feature"> <img src="img/feature2.jpg"> <h4>导游服务</h4> <p>我们的专业导游将为您提供全面的旅游指导和解说服务</p> </div> <div class="feature"> <img src="img/feature3.jpg"> <h4>住宿安排</h4> <p>我们将为您安排最舒适的住宿环境,让您的旅途更加愉快</p> </div> </div> </section> <section id="destinations"> <div class="container"> <h3>热门旅游目的地</h3> <div class="destination"> <img src="img/destination1.jpg"> <h4>巴黎</h4> <p>浪漫之都,充满了艺术和文化的气息</p> <a href="#" class="btn">了解更多</a> </div> <div class="destination"> <img src="img/destination2.jpg"> <h4>东京</h4> <p>现代化城市,古老的文化和新潮的时尚完美结合</p> <a href="#" class="btn">了解更多</a> </div> <div class="destination"> <img src="img/destination3.jpg"> <h4>夏威夷</h4> <p>阳光海滩,美丽的自然风光和热情的人民</p> <a href="#" class="btn">了解更多</a> </div> </div> </section> <footer> <div class="container"> <p>版权所有 © 2021 旅游网页</p> <nav> <ul> <li><a href="#">使用条款</a></li> <li><a href="#">隐私政策</a></li> <li><a href="#">联系我们</a></li> </ul> </nav> </div> </footer> <script src="script.js"></script> </body> </html> ``` CSS代码: ```css /* 全局样式 */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; color: #333; } a { color: #337ab7; text-decoration: none; } a:hover { text-decoration: underline; } /* 头部样式 */ header { background-color: #f1f1f1; padding: 20px 0; } .container { width: 80%; margin: 0 auto; } nav ul { list-style: none; display: flex; } nav li { margin-right: 20px; } nav li:last-child { margin-right: 0; } nav a { font-weight: bold; } /* 横幅样式 */ #banner { background-image: url('img/banner.jpg'); background-size: cover; background-position: center center; height: 500px; display: flex; align-items: center; justify-content: center; } #banner h2 { font-size: 48px; color: #fff; text-align: center; margin-bottom: 20px; } #banner p { font-size: 24px; color: #fff; text-align: center; margin-bottom: 40px; } .btn { display: inline-block; background-color: #337ab7; color: #fff; padding: 10px 20px; border-radius: 5px; } .btn:hover { background-color: #23527c; } /* 特色服务样式 */ #features { padding: 80px 0; background-color: #f9f9f9; } #features h3 { font-size: 36px; margin-bottom: 40px; text-align: center; } .feature { width: 33.33%; text-align: center; padding: 0 20px; display: inline-block; vertical-align: top; } .feature img { width: 100%; } .feature h4 { font-size: 24px; margin-top: 20px; margin-bottom: 10px; } .feature p { font-size: 16px; color: #666; margin-bottom: 20px; } /* 热门旅游目的地样式 */ #destinations { padding: 80px 0; } #destinations h3 { font-size: 36px; margin-bottom: 40px; text-align: center; } .destination { width: 33.33%; text-align: center; padding: 0 20px; display: inline-block; vertical-align: top; } .destination img { width: 100%; } .destination h4 { font-size: 24px; margin-top: 20px; margin-bottom: 10px; } .destination p { font-size: 16px; color: #666; margin-bottom: 20px; } /* 底部样式 */ footer { background-color: #333; color: #fff; padding: 20px 0; } footer p { text-align: center; margin-bottom: 20px; } footer nav ul { list-style: none; display: flex; justify-content: center; } footer li { margin-right: 20px; } footer li:last-child { margin-right: 0; } ``` JavaScript代码: ```javascript // 在此添加JavaScript代码 // 比如轮播图、交互效果等 ``` 请注意,这只是一个基本的框架,需要您根据自己的需求进行修改和定制。同时,您还需要添加图片、JavaScript代码、样式表和其他资源文件,以便完整地呈现您的旅游网页。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java Fans

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值