资源仅供展示,自行补充
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.show{
width: 400px;
overflow: hidden;
position: relative;
}
.boxs{
display: flex;
width: 1600px;
margin-left:0px;
}
.box{
width: 400px;
position: relative;
}
.box>img{
width:100%;
}
.box>p{
width: 100%;
position:absolute;
line-height: 20px;
background: rgba(0,0,0,0.5);
bottom:5px;
color:#fff;
z-index: 2;
}
.con{
position: absolute;
width: 100%;
z-index: 3;
height: 100%;
}
.con>div{
width: 50px;
height:50px;
background:rgba(0,0,0,0.5);
color: #fff;
font-size: :36px;
line-height: 50px;
text-align: center;
position: absolute;
top: 50%;
margin-top: -25px;
cursor: pointer;
}
.con>div:hover{
background: #000;
}
.right{
right: 0;
}
.balls{
display: flex;
position: absolute;
z-index: 10;
bottom:10px;
right:10px;
}
.ball{
width: 10px;
height: 10px;
background: rgba(255,255,255,0.5);
border-radius: 5px;
margin:5px;
cursor: pointer;
}
.ball:hover{
background: white;
}
html,body{
width: 100%;
height: 100%;
}
body{
width: 50%;
height: 50%;
font-family: "微软雅黑";
background: repeat;
background: url(img/lizi.gif) no-repeat;
background-size: 120% 120%;
}
.top>l{
font-family: "微软雅黑";
font-size: 130px;
text-shadow: 0 0 24px palevioletred;
color: palegoldenrod
}
</style>
<script src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(function(){
x=0
$(".right").click(function(){
x=x-400;
if(x<-1200){x=0;}
$(".boxs").css({"margin-left":x+"px"})
})
$(".left").click(function(){
x=x+400;
if(x>0){x=-1200;}
$(".boxs").css({"margin-left":x+"px"})
})
$(".ball").click(function(){
n=$(this).attr("title")
x=-400*n
$(".boxs").css({"margin-left":x+"px"})
})
})
$(function(){
$(".nav li").click(function(){
msg=$(this).attr("title")
//alert(msg)//
$(".con").css({"display":"none"})
$(msg).css({"display":"block"})
})
})
</script>
</script>
</head>
<body>
<div class="top">
<l>
<a>2020《人类与太空》</a>
</l>
</div>
<div class="show">
<div class="con">
<div class="left"><</div>
<div class="right">></div>
</div>
<div class="balls">
<div class="ball"title="0"></div>
<div class="ball"title="1"></div>
<div class="ball"title="2"></div>
<div class="ball"title="3"></div>
</div>
<div class="boxs">
<div class="box">
<img src="img/a1.jpg" alt="">
<p>很早以前人们开始探索</p>
</div>
<div class="box">
<img src="img/a2.jpg" alt="">
<p>对于探索空间站是首选</p>
</div>
<div class="box">
<img src="img/a3.jpg" alt="">
<p>火箭达成人类与太空的桥梁</p>
</div>
<div class="box">
<img src="img/a4.jpeg" alt="">
<p>天琴座流星雨如约而至</p>
</div>
</body>
</html>
效果如下: