HTML + CSS + jQuery imitates the effect of search Fengbang tab with screenshot

Time:2020-8-1

Copy code

The code is as follows:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
< title > List tab
<style type=”text/css”>
body{
margin:0px;
padding:0px;
}
#main{
width:310px;
border:1px solid #C8C8CC;
margin-left:auto;
margin-right:auto;
margin-top:50px;
}
.main_title{
width:310px;
border-bottom:1px solid #C8C8CC;
height:30px;
}
#main div .chang{
border:1px solid #C8C8CC;
float:left;
width:153px;
height:26px;
text-align:center;
padding-top:4px;
cursor:pointer;
}
.main_head{
width:310px;
height:25px;
background-color:#FFF4F8;
}
.main_head font{
font-size:13px;
color:#808080;
margin-top:5px;
}
.main_content{
width:310px;
border-top:1px solid #808080;
}
.main_content ul{
margin-left:-30px;
margin-top:5px;
width:290px;
}
.main_content ul li{
list-style-type:none;
font-size:13px;
color:#2464B2;
border-bottom:1px dotted #808080;
line-height:27px;
}
.main_content ul li a{
font-size:13px;
color:#2464B2;
text-decoration:none;
}
.main_content ul li a:hover{
text-decoration:underline;
}
#main div ul.main_content_chang{
width:290px;
position:relative;
z-index:100;
top:0px;
left:0px;
display:block;
}
#main div ul{
position:relative;
display:none;
}
</style>
<script type=”text/javascript” src=”js/jquery-1.9.1.js”></script>
<script type=”text/javascript”>
$(function(){
$(“.chang”).each(function(index){
$(this).click(function(){
$(this).css(“background-color”,”#E02D29″);
$(this).siblings(“div”).css(“background-color”,”#fff”);
$(“#main div ul”).removeClass(“main_content_chang”);
$(“.main_content ul:eq(“+index+”)”).show().siblings(“ul”).hide();
})
})
})
</script>
</head>
<body>
<div>
<div>
< div style = “background: # e02d29” > real time hotspot < / div >
<div style=” float:right; “> focus on the 7th < / div >
</div>
<div>
<! — real time hotspots
<ul>
<li><img src=”img/1_ 1. JPG “/ > < a ref” # “> from the stars</a></li>
<li><img src=”img/1_ 2. JPG “/ > < a Ref.” ා “> customized</a></li>
<li><img src=”img/3_ 1. JPG “/ > < a ref” ා “> all around Star Wars</a></li>
<li><img src=”img/1_ 4. JPG “/ > < a http://www.jpg.com >” > jiaduobao</a></li>
<li><img src=”img/1_ 5. JPG “/ > after giving birth to a child in the toilet for girls</a></li>
<li><img src=”img/1_ 6. JPG “/ > < a ref” ා “> Yuantong life-threatening Express</a></li>
<li><img src=”img/1_ 7. JPG “/ > < a Ref.” ා “> a copy of Cecilia Cheung’s</a></li>
<li><img src=”img/1_ 8. JPG “/ > < a ref =” ා “> Li Yanpeng lied</a></li>
<li><img src=”img/1_ 9. JPG “/ > < a ref” ා “> 170 million yuan passbook</a></li>
<li><img src=”img/1_ 10. JPG “/ > < a http: / / ා” > the post-90s drowned their own daughter to please their boyfriends</a></li>
<li style=”text- align:right; border-bottom- style:none “><a href=”#” style=”font- size:15px “> view the full list</a></li>
</ul>
<! — focus on the 7th
<ul>
<li><img src=”img/1_ 1. JPG “/ > < a ref” ා “> the mysterious sword unearthed in Nanjing</a></li>
<li><img src=”img/1_ 2. JPG “/ > < a http: / / www</a></li>
<li><img src=”img/3_ 1. JPG “/ > Wal Mart apologized</a></li>
<li><img src=”img/1_ 4. JPG “/ > for girls who buy hairpins</a></li>
<li><img src=”img/1_ 5. JPG “/ > < a ref =” # “> fake Maotai cheated 200 million loans</a></li>
<li><img src=”img/1_ 6. JPG “/ > < a ref” # “> the man received the Christmas gift from his wife</a></li>
<li><img src=”img/1_ 7. JPG “/ > the world’s most beautiful 100</a></li>
<li><img src=”img/1_ 8. JPG “/ > < a ref” ා “> 80 million meteorites</a></li>
<li><img src=”img/1_ 9. JPG “/ > < a ref” ා “> Abe visits Yasukuni Shrine</a></li>
<li><img src=”img/1_ 10. JPG “/ > < a ref” ා “> Spring Festival Gala stage exposure</a></li>
<li style=”text- align:right; border-bottom- style:none “><a href=”#” style=”font- size:15px “> view the full list</a></li>
</ul>
</div>
</div>
</body>
</html>

The results showed that: