当前位置:网站首页>Simple rotation chart
Simple rotation chart
2022-07-27 07:25:00 【Ape code takes the lead】
html part
<body>
<div class="foucs" onmouseover="end()" onmouseout="start()">
<div id="imgs">
<img src="./img/1.jpg" />
<img src="./img/2.jpg" />
<img src="./img/3.jpg" />
<img src="./img/4.jpg" />
<img src="./img/5.jpg" />
</div>
<div class="nav">
<ul id="list">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</div>
<h1 id="left" onclick="left()"><</h1>
<h1 id="right" onclick="right()">></h1>
</div>
</body>css Style segment
<style>
*{
margin: 0;
padding: 0;
}
div.foucs{
position: relative;
}
div.foucs:hover{
cursor: pointer;
}
div.foucs h1{
position: absolute;
font-size: 50px;
}
div.foucs h1#left{
top: 150px;
}
div.foucs h1#right{
top: 150px;
right: 10px;
}
div.foucs img{
width: 100%;
height: 350px;
display: none;
}
ul{
list-style: none;
position: absolute;
bottom: 10%;
left: 30%;
/* background-color: brown; */
}
ul li{
display: inline-block;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
margin: 0 30px;
background-color: darkgrey;
border-radius: 50%;
}
</style>js part
<script>
let i = 0;
function demo(){
let imgs = document.getElementById("imgs").children;
let list = document.getElementById("list").children;
for(let n =0;n<imgs.length;n++){
imgs[n].style = "display:none";
list[n].style = "background-color:darkgrey";
}
imgs[i].style = "display:block";
list[i].style = "background-color:red";
i++;
if(i==imgs.length){
i=0;
}
}
demo();
let interval = setInterval(demo,3000);
function end(){
clearInterval(interval);
}
function start(){
interval = setInterval(demo,3000);
}
let j = 0;
let list = document.getElementById("list").children;
while(j<list.length){
list[j].index = j;
list[j].onmouseover = function(){
i = this.index;
demo();
}
j++;
}
function left(){
let imgs = document.getElementById("imgs").children;
if(i==1){
i = imgs.length - 1;
}else if(i==0){
i = imgs.length-2;
}else{
i-=2;
}
// i-=2;
demo();
}
function right(){
demo();
}
</script>It can automatically rotate photos , You can click navigation to switch , You can click the left and right buttons to switch , When the mouse hovers over the picture , Stop the wheel set. , Continue playing after leaving
边栏推荐
- Codeforces Round #804 (Div. 2)(5/5)
- vlan间路由(讲解+验证)
- Functools module
- Go obtains the processing results of goroutine through channel
- Firefox browser, when accessing Tencent cloud server, failed to establish a secure connection.
- Pan Aimin, chairman of instruction set, attended the 2022 ecug con to speak for China's technical forces
- C4D动画如何提交云渲染农场快速渲染?
- 如何取得对象的DDL信息
- No.0 training platform course-2. SSRF Foundation
- 2022-07-25 Gu Yujia's study notes
猜你喜欢

VLAN trunk实验

sql-labs SQL注入平台-第1关Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)

TCP/IP协议分析(TCP/IP三次握手&四次挥手+OSI&TCP/IP模型)

35. Search insert position

Quartus: an error is reported when adding a.V file to someone else's project

js做一个红绿灯

Advanced IO outline

Tcp/ip protocol analysis (tcp/ip three handshakes & four waves + OSI & TCP / IP model)

How to implement Devops with automation tools | including low code and Devops application practice

使用pip命令切换不同的镜像源
随机推荐
Functools module
Relevant principles of MySQL index optimization
yhb_sysbench
How MySQL executes query statements
用shell来计算文本中的数字之和
2022 0726 Gu Yujia's study notes
Drools (5): drools advanced syntax
在Perl程序中暴露Prometheus指标
【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
Codeforces Round #787 (Div. 3)(7/7)
一款开源 OA 办公自动化系统
(2022牛客多校三)A-Ancestor(LCA)
Quartus: an error is reported when adding a.V file to someone else's project
使用popen来执行一个命令并获得返回结果
SQLite 常用功能整合
ADB instruction sorting
Oracle database problems
LogCat工具
在rhel7.3中编译和使用log4cxx
Codeforces Round #804 (Div. 2)(5/5)