目录
1技术栈
需要用到的技术
JavaScript
html
css
库:jQuery
2开发代码
1.中部栏目
html代码:
<!--------------------------------->
<div class="centre">
<div class="cen_left">
<div><a href="#"><img src="./images/001.png">保障服务</a></div>
<div><a href="#"><img src="./images/002.png">企业团购</a></div>
<div class="qc"><a href="#"><img src="./images/003.png">F码通道</a></div>
<div><a href="#"><img src="./images/004.png">米粉卡</a></div>
<div><a href="#"><img src="./images/005.png">以旧换新</a></div>
<div class="qc"><a href="#"><img src="./images/006.png">话费充值</a></div>
</div>
<div class="cen_right">
<a href="#"><img src="./images/redmi.jpg"></a>
<a href="#"><img src="./images/note11t.jpg"></a>
<a href="#"><img src="./images/xiaomi.jpg" class="imgr"></a>
</div>
</div>
css代码:
/* ------------------------------------------ */
.centre {
width: 1226px;
height: 170px;
margin: auto;
margin-top: 20px;
margin-bottom: 30px;
}
.centre .cen_left {
/* 左边 */
height: 170px;
width: 234px;
float: left;
background-color: #5f5750;
padding-left: 4px;
position: relative;
}
.centre .cen_left div {
width: 76px;
height: 82px;
display: inline-block;
float: left;
}
.centre .cen_left div::after {
content: "";
height: 70px;
width: 1px;
background-color: #665e57;
position: absolute;
margin-top: 7px;
margin-left: 3px;
}
.centre .cen_left .qc::after {
width: 0;
}
.centre .cen_left div a:hover {
color: #ffffff;
}
.centre .cen_left div a {
display: inline-block;
width: 70px;
height: 64px;
color: #cfccca;
font-size: 12px;
text-align: center;
padding-top: 18px;
border-top: 1px solid #665e57;
}
.centre .cen_left div a img {
display: block;
width: 24px;
height: 24px;
margin: auto;
}
/* ------------------------- */
/* right */
.centre .cen_right {
height: 170px;
width: 978px;
float: right;
}
.centre .cen_right a img {
width: 316px;
height: 170px;
display: inline-block;
margin-right: 15px;
float: left;
}
.centre .cen_right a .imgr {
margin-right: 0;
}
/* -------------------------------------------- */
2.中部图片
html代码:
<div class="tpjg"></div>
<div class="tp">
<a href="#">
<img src="./images/e.webp">
</a>
</div>
cs代码:
.zjbj .tpjg {
width: 1226px;
height: 20px;
margin-left: auto;
margin-right: auto;
}
.zjbj .tp {
width: 1226px;
height: 120px;
margin-left: auto;
margin-right: auto;
margin-bottom: 20px;
}
3.商品栏
这里能够实现鼠标放到商品上后商品栏目背部有阴影以及出现一种漂浮的效果
这里能够通鼠标放在穿戴 热门上进行视频栏切换
html代码:
<div class="sj">
手机
<a href="#">查看更多 </a>
</div>
<div class="sjnr">
<div class="sjLeft">
<img src="./images/xmsj.webp">
</div>
<div class="sjRight">
<div>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sj1.webp">
<h3>Redmi Note 11T Pro+</h3>
<p class="oo1">天玑8100|真旗舰芯</p>
<p class="oo2">
<span>1999元起</span>
<del><span>2099元</span></del>
</p>
</a>
</div>
</div>
</div>
<!-- ------------------------------------------ -->
<div class="sj">
智能穿戴
<a href="#">
<a href="#" id="rm">热门 </a>
<a href="#" id="cd">穿戴</a>
</a>
</div>
<div class="sjnr">
<div class="sjLeft">
<img src="./images/hmsj.webp">
</div>
<div class="sjRight" id="sjR1">
<div id="sjRt">
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#" id="llgd">
<span class="zo">
<span id="sp1">浏览更多</span>
<span id="sp2">热门</span>
</span>
<span class="yo"></span>
</a>
</div>
<div id="sjRi">
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#">
<img src="./images/sb1.webp">
<h3>Xiaomi Watch S1</h3>
<p class="oo1">蓝宝石玻璃镜面|不锈钢中框|</p>
<p class="oo2">
<span>1049元起</span>
<del><span>1099元</span></del>
</p>
</a>
<a href="#" id="llgd">
<span class="zo">
<span id="sp1">浏览更多</span>
<span id="sp2">热门</span>
</span>
<span class="yo"></span>
</a>
</div>
</div>
</div>
<!-- ---------------------------------------------- -->
css代码:
/* -------------------------------------------- */
.zjbj {
background-color: #f5f5f5;
width: 100%;
height: 4000px;
}
.zjbj .tpjg {
width: 1226px;
height: 20px;
margin-left: auto;
margin-right: auto;
}
.zjbj .tp {
width: 1226px;
height: 120px;
margin-left: auto;
margin-right: auto;
margin-bottom: 20px;
}
.zjbj div a img {
display: block;
width: 1226px;
height: 120px;
margin: auto;
}
.zjbj .sj {
width: 1226px;
height: 58px;
margin-left: auto;
margin-right: auto;
line-height: 58px;
font-size: 22px;
color: #424242;
}
.zjbj .sj a {
height: 58px;
float: right;
line-height: 58px;
font-size: 18px;
color: #424242;
font-family: 'icomoon';
}
.zjbj .sj a:hover {
color: #ff6a00;
}
.zjbj .sjnr {
width: 1226px;
height: 628px;
margin-left: auto;
margin-right: auto;
}
.zjbj .sjnr .sjLeft {
display: inline-block;
height: 628px;
width: 234px;
float: left;
perspective: 100px;
}
.zjbj .sjnr .sjLeft img {
width: 234px;
height: 614px;
background-color: #ffffff;
}
@keyframes shang {
0% {
position: relative;
top: 0;
}
100% {
position: relative;
top: -4px;
box-shadow: 0px 0px 30px 10px #e7e5e5;
}
}
.zjbj .sjnr .sjLeft img:hover {
/* 点击样式 */
cursor: pointer;
animation-name: shang;
animation-duration: 0.3s;
animation-fill-mode: forwards;
animation-timing-function: linear;
}
.zjbj .sjnr .sjRight {
display: inline-block;
height: 628px;
width: 978px;
float: right;
}
.zjbj .sjnr .sjRight div {
width: 992px;
height: 614px;
margin-left: -14px;
}
.zjbj .sjnr .sjRight div a {
width: 234px;
height: 300px;
padding: 30px 0;
float: left;
background-color: #ffffff;
margin-left: 14px;
margin-bottom: 14px;
}
.zjbj .sjnr .sjRight div a:hover {
/* 点击样式 */
cursor: pointer;
animation-name: shang;
animation-duration: 0.3s;
animation-fill-mode: forwards;
animation-timing-function: linear;
}
.zjbj .sjnr .sjRight div a img {
width: 160px;
height: 160px;
}
.zjbj .sjnr .sjRight div a h3 {
width: 214px;
height: 21px;
text-align: center;
margin: 10px;
font-size: 12.6px;
margin-bottom: 0;
color: #333333;
}
.zjbj .sjnr .sjRight div a .oo1 {
width: 214px;
height: 18px;
text-align: center;
font-size: 12px;
margin: 10px;
margin-top: 0;
color: #b0b0b0;
}
.zjbj .sjnr .sjRight div a .oo2 {
width: 214px;
height: 21px;
text-align: center;
font-size: 12px;
margin: 10px;
}
.zjbj .sjnr .sjRight div a .oo2>span {
color: #ff6a00;
}
.zjbj .sjnr .sjRight div a .oo2 del {
color: #b4b4b4;
}
/* --------------------------------------- */
#rm {
display: inline-block;
text-align: center;
}
#cd {
display: inline-block;
width: 100px;
color: #ff6a00;
}
#llgd {
height: 150px;
position: relative;
}
#llgd .yo {
font-family: 'icomoon';
font-size: 50px;
position: absolute;
top: 50px;
right: 40px;
color: #ff6a00;
}
#llgd .zo {
position: absolute;
top: 60px;
left: 30px;
color: #ff6a00;
}
#llgd .zo span {
display: block;
color: #333333;
}
#llgd .zo #sp1 {
font-size: 20px;
}
#llgd .zo #sp2 {
font-size: 12px;
color: #757575;
}
/* ------------------------------- */
JavaScript代码:
<script>
$(function () {
$('#sjRt').show()
$('#sjRi').hide()
});
$('#cd').mouseenter(function () {
$('#cd').css("color", "#ff6a00")
$('#rm').css("color", "#424242")
$('#sjRt').show()
$('#sjRi').hide()
})
$('#rm').mouseenter(function () {
$('#rm').css("color", "#ff6a00")
$('#cd').css("color", "#424242")
$('#sjRt').hide()
$('#sjRi').show()
})
</script>
最终效果: