1.代码如下

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
<title>Document</title>
<style>
* {
box-sizing: border-box;
} body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
display: flex;
width: 90vw;
}
.panle {
background-size: auto, 100%;
background-position: center;
background-repeat: no-repeat;
border-radius: 50px;
color: #fff;
flex: 0.5;
cursor: pointer;
height: 80vh;
position: relative;
margin: 10px;
transition: flex 0.7s cubic-bezier(0.05, 0.6, 0.4, 0.9);
}
.panle h3 {
font-size: 24px;
opacity: 0;
position: absolute;
bottom: 20px;
left: 20px;
margin: 0;
transition: opacity 0s ease-in 0s;
}
.panle.active {
flex: 5;
}
.panle.active h3 {
opacity: 1;
transition: opacity 0.3s ease-in 0.4s;
}
@media (max-width: 500px) {
.container {
width: 100vw;
}
.panle:nth-of-type(4) {
display: none;
}
.panle:nth-of-type(5) {
display: none;
}
}
</style>
</head>
<body>
<div class="container">
<div class="panle" style="background-image: url(./img/img1.jpg);">
<h3>海阔天空</h3>
</div>
<div class="panle" style="background-image: url(./img/img2.jpg);">
<h3>蓝天白云</h3>
</div>
<div class="panle" style="background-image: url(./img/img3.jpg);">
<h3>山川湖海</h3>
</div>
<div class="panle" style="background-image: url(./img/img4.jpg);">
<h3>星空灿烂</h3>
</div>
<div class="panle" style="background-image: url(./img/img5.jpg);">
<h3>绿树成荫</h3>
</div>
</div> <script>
const penles = document.querySelectorAll(".panle");
penles.forEach((panle) => {
panle.addEventListener("click", () => {
removeClass();
panle.classList.add("active");
});
function removeClass() {
penles.forEach((penle) => {
penle.classList.remove("active");
});
}
});
</script>
</body>
</html>

2.效果展示



3.使用资源图片如下







-------------完成!!!!!!!

最新文章

  1. Javascript 小技能
  2. java项目的划分方式:模块优先还是层优先?
  3. PHP截取IE浏览器并缩小原图的方法
  4. linux dsp 播放音频文件
  5. awk 的一个奇怪异常
  6. Linux中ifreq 结构体分析和使用
  7. hibernate数据库方言
  8. (8/18)重学Standford_iOS7开发_协议、block、动画_课程笔记
  9. java第二周学习日记
  10. Error : APP-FND-01926: The custom event WHEN-LOGON-CHANGED raised unhandled exception: ORA-06502: PL
  11. IntelliJ Idea和IntelliJ webstrm 常用快捷键
  12. DG环境的日常巡检
  13. Linux后台运行命令 nohup command &gt; myout.file 2&gt;&amp;1
  14. Python模块探秘之smtplib,实现纯文本邮件的发送
  15. vector入门
  16. winSCP无法连接虚拟机Linux解决
  17. 获取C#中方法的执行时间及其代码注入
  18. 从前端和后端两个角度分析jsonp跨域访问(完整实例)
  19. js 停止事件冒泡 阻止浏览器的默认行为(比如阻止超连接 # )
  20. 使用shell脚本批处理控制大数据环境服务启动停止

热门文章

  1. MySQL 统计行数的 count
  2. $props, $attrs,$listeners的具体使用例子
  3. go例子(三) 使用context实现发牌手策略
  4. echarts legend文字配置多个颜色(转)
  5. EPX Studio产品功能介绍
  6. IdentityServer4实现.Net Core API接口权限认证(快速入门)
  7. Spring Data JPA 自定义对象接收查询结果集
  8. Oracle 中文日期转换
  9. RTSP协议进行视频取流的方法、注意点及python实现
  10. 关于Web2.0