HTML代码:
复制代码 代码如下:
<body>
<div style="overflow:hidden;width:360px;height:225px;position:absolute;top:30px;" id="div">
<div style="width: 360px; height: 900px; position: relative;" id="imgCon">
<img src="/UploadFiles/2021-04-02/1.jpg"><img src="img/2.jpg"><img src="/UploadFiles/2021-04-02/3.jpg"><img src="img/1a.jpg"><img src="/UploadFiles/2021-04-02/1.jpg"></div>
</div>
<div class="box" num="0" id="box0" style="color:red;">1</div>
<div class="box" num="1" id="box1">2</div>
<div class="box" num="2" id="box2">3</div>
<div class="box" num="3" id="box3">4</div>
</body>
JS代码:
复制代码 代码如下:
<script type="text/javascript">
$(document).ready(function(){
$("#box0").click(function(){
//$("#imgCon").slideUp(4200);
$("#imgCon").animate({top:'-225px'},"slow");
});
$("#box1").click(function(){
$("#imgCon").animate({top:'-450px'},"slow");
});
$("#box2").click(function(){
$("#imgCon").animate({top:'-675px'},"slow");
});
$("#box3").click(function(){
$("#imgCon").animate({top:'-900px'},"slow");
});
});
</script>
CSS:代码:
复制代码 代码如下:
<style type="text/css">
.box{
width:40px;
height:20px;
border:1px solid #000;
float:left;
cursor:pointer;
}
#imgCon img{
display:block;
padding:0;
margin:0;
width:360px;
height:225px;
}
</style>
复制代码 代码如下:
<body>
<div style="overflow:hidden;width:360px;height:225px;position:absolute;top:30px;" id="div">
<div style="width: 360px; height: 900px; position: relative;" id="imgCon">
<img src="/UploadFiles/2021-04-02/1.jpg"><img src="img/2.jpg"><img src="/UploadFiles/2021-04-02/3.jpg"><img src="img/1a.jpg"><img src="/UploadFiles/2021-04-02/1.jpg"></div>
</div>
<div class="box" num="0" id="box0" style="color:red;">1</div>
<div class="box" num="1" id="box1">2</div>
<div class="box" num="2" id="box2">3</div>
<div class="box" num="3" id="box3">4</div>
</body>
JS代码:
复制代码 代码如下:
<script type="text/javascript">
$(document).ready(function(){
$("#box0").click(function(){
//$("#imgCon").slideUp(4200);
$("#imgCon").animate({top:'-225px'},"slow");
});
$("#box1").click(function(){
$("#imgCon").animate({top:'-450px'},"slow");
});
$("#box2").click(function(){
$("#imgCon").animate({top:'-675px'},"slow");
});
$("#box3").click(function(){
$("#imgCon").animate({top:'-900px'},"slow");
});
});
</script>
CSS:代码:
复制代码 代码如下:
<style type="text/css">
.box{
width:40px;
height:20px;
border:1px solid #000;
float:left;
cursor:pointer;
}
#imgCon img{
display:block;
padding:0;
margin:0;
width:360px;
height:225px;
}
</style>
标签:
jquery,图片展示
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“jquery实现简单易懂的图片展示小例子”评论...