当前位置:网站首页>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
边栏推荐
- MySQL2
- Algorithm -- Fibonacci sequence (kotlin)
- Guava的基础功能与集合
- docker安装MySQL8.0.28
- jjwt 生成token
- Tableau prep is connected to maxcompute and only writes simple SQL. Why is this error reported?
- Use the PIP command to switch between different mirror sources
- Drools (5): drools basic syntax (3)
- flink cdc 抽取oracle的数据,会不断的占用oracle的内存吗,最后引发ora-040
- A Competitive Swarm Optimizer for Large Scale Optimization
猜你喜欢
随机推荐
centos7中关闭oracle服务自动启动的功能
(posted) comparison of Eureka, consumer and Nacos 1
(2022 Niuke multi school III) a-ancestor (LCA)
Pg_relation_size 问题
Pan Aimin, chairman of instruction set, attended the 2022 ecug con to speak for China's technical forces
TCP/IP协议分析(TCP/IP三次握手&四次挥手+OSI&TCP/IP模型)
Internal class -- just read this article~
How to implement Devops with automation tools | including low code and Devops application practice
【golang学习笔记2.0】 golang中的数组和切片
2022 0726 Gu Yujia's study notes
VLAN trunk experiment
Tableau prep is connected to maxcompute and only writes simple SQL. Why is this error reported?
SQLite 常用功能整合
零号培训平台课程-2、SSRF基础
用oracle来演示外键的使用
一款开源 OA 办公自动化系统
UUID与secrets模块
使用popen来执行一个命令并获得返回结果
高级IO提纲
yhb_sysbench









