当前位置:网站首页>Simple native JS tab bar switching
Simple native JS tab bar switching
2022-06-25 19:16:00 【Good first】
<!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>
<style>
*{
margin: 0 ;
padding: 0;
}
.syr{
width: 600px;
height: 400px;
border: 1px solid red;
margin: 100px auto;
}
.item{
width: 100%;
height: 40px;
border: 1px solid red;
display: flex;
align-items: center;
justify-content: space-around;
}
.item span{
border: 1px solid red;
padding: 10px 70px;
}
.itemlist{
width: 100%;
height: 356px;
border: 1px solid red;
display: flex;
align-items: center;
justify-content: center;
}
.itemLists{
display: none;
}
.nones{
display: block;
}
</style>
</head>
<body>
<div class="syr">
<div class="item">
<span class="itemss nones"> Content of a </span>
<span class="itemss"> Content of the two </span>
<span class="itemss"> Content of the three </span>
</div>
<div class="itemlist">
<span class="itemLists nones"> Content of a </span>
<span class="itemLists"> Content of the two </span>
<span class="itemLists"> Content of the three </span>
</div>
</div>
<script>
var item = document.getElementsByClassName('itemss');
var itemLists = document.getElementsByClassName('itemLists');
// Add class nomenclature
for (let i = 0; i < item.length; i++) {
const element = item[i];
element.onclick = function () {
for (let k = 0; k < itemLists.length; k++) {
if (i == k) {
itemLists[k].classList.add('nones'); // Add with display block The name of the class
}else{
itemLists[k].classList.remove('nones');// Delete with display block The name of the class
}
}
}
}
// display Law
// for (let i = 0; i < item.length; i++) {
// const element = item[i];
// element.onclick = function () {
// console.log(i);
// for (let k = 0; k < itemLists.length; k++) {
// if (i == k) {
// itemLists[k].style.display = 'block'
// }else{
// itemLists[k].style.display = 'none'
// }
// }
// }
// }
</script>
</body>
</html>
边栏推荐
- On location and scale in CNN
- Guangzhou Sinovel interactive creates VR Exhibition Hall panoramic online virtual exhibition hall
- Uncover ges super large scale graph computing engine hyg: Graph Segmentation
- QQ robot: self forbidden words management of group members [latest beta2 version]
- Tcp/ip test questions (V)
- Kotlin Compose 终结toDo项目 点击可以编辑修改todo
- Trend ea- fixed stop loss and profit per order
- Do you want to know how new investors open accounts? Is online account opening safe?
- Leetcode-78-subset
- What should I pay attention to in GoogleSEO content station optimization?
猜你喜欢
![Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]](/img/19/d93c8647415c593de9c3c959f72d64.jpg)
Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]

Genicam gentl standard ver1.5 (1)
![[C language practice - print the upper triangle and its deformation (with blank version)]](/img/df/f38dc57c6a2de522acd91929ced1ad.png)
[C language practice - print the upper triangle and its deformation (with blank version)]

Tiger DAO VC产品正式上线,Seektiger生态的有力补充

PHP synchronizes website content to hundreds of websites to improve SEO ranking

削足适履 - 谈谈赛道上的坡道改造

Process of vacuum and vacuum full
![Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]](/img/b3/73e01601885eddcd05b68a20f83ca8.jpg)
Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]

如何快速关闭8080端口

Ali visual AI training camp -day05- creativity day - your image recognition project
随机推荐
三、HikariCP获取连接流程源码分析三
R语言plotly可视化:plotly可视化二维直方图等高线图(Basic 2D Histogram Contour)
Validation of TTF font by validator of laravel
ECS 7-day practical training camp (Advanced route) -- day03 -- ecs+slb load balancing practice
PostgreSQL user role permissions
Apifox simple understanding -- the integrator of web side testing
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
IDEA常用插件
SQL is used for field data types in various databases
What are Baidu collection skills? 2022 Baidu article collection skills
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]
Cutting feet to fit shoes - talking about the ramp reconstruction on the track
Network security detection and prevention test questions (V)
Install spoole
Why are life science enterprises on the cloud in succession?
Kotlin compose terminate todo project Click to edit and modify todo
solidity 合约地址转钱包、钱包地址转合约
Miner's Diary: why should I go mining on April 5, 2021
Trend ea- fixed stop loss and profit per order
Tcp/ip test questions (III)