<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js实现图片无缝轮播</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<style>
.b2{
width: 200px;
height: 200px;
margin: 44px auto 0;
position: relative;
overflow: hidden;
background-color: gray;
}
.b2 .b2list{
width: 600px;
height: 200px;
position: absolute;
top: 0;
left: 0;
}
.b2 .item{
width: 200px;
height: 200px;
float: left;
}
.b2 .item:nth-child(1) {
background-image: url("https://ximg.2cq.com/img/system/ad/tieba/7665cfeb1b50e560693509b7a4045861.jpeg");
background-size: 200px 200px;
}
.b2 .item:nth-child(2){
background-image: url("https://ximg.2cq.com/img/system/ad/tieba/ee34f88f37b317849cc0e80076b89bab.jpeg");
background-size: 200px 200px;
}
.b2 .item:nth-child(3){
background-image: url("https://ximg.2cq.com/img/system/ad/tieba/1c9b819f1b9ede319e8e1b8ba63066e8.jpeg");
background-size: 200px 200px;
}
</style>
<body>
<div class="b2">
<div class="b2list" data="0">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
</div>
</div>
<script>
$(function(){
setInterval("auto_left_me();",3000);
});
function auto_left_me(){
var num = $(".b2 .b2list").attr("data");
num++; if(num>2){
num=0;
}
$(".b2 .b2list").attr("data",num);
$('.b2 .b2list').animate({'left':-200*num});
} </script>
</body>
</html>

最新文章

  1. git仓库的初始化
  2. C#基础-关于用json给控制台程序传值的坑
  3. atitit.web 推送实现方案集合(2)---百度云,jpush 极光推送 ,个推的选型比较.o99
  4. debug进入线程中
  5. 跟上节奏 大数据时代十大必备IT技能(转)
  6. 部署新浪SAE web.py Session及图片上传等问题注意事项
  7. 【BZOJ】【1565】【NOI2009】PVZ 植物大战僵尸
  8. Eclipse下Tomcat常用设置
  9. information_schema.referential_constraints 学习
  10. 《深入理解OSGi:Equinox原理、应用与最佳实践》笔记_1_运行最简单的bundlehelloworld
  11. Backbone视图渲染React组件
  12. 泛型里的super和extend
  13. ●UVA 1608 Non-boring sequences
  14. android开发之调试技巧
  15. 海量数据挖掘MMDS week5: 计算广告Computational Advertising
  16. 微信小程序 写一个获取验证码 及setInterval 使用基本方法
  17. Python——使用第三方库Pillow生成图片缩略图
  18. 抓取某网站信息时遇到的问题及解决 The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set
  19. MySQL参数最大连接数max_connections
  20. 1840: Jack Straws

热门文章

  1. SpringBoot整合WEB开发--(八)启动任务系统
  2. git配置多仓库
  3. Chrome浏览器控制台报Refused to get unsafe header &quot;XXX&quot;的错误
  4. AcWing 1058. 股票买卖 V
  5. eclipse新建web项目,并将其部署到tomcat
  6. sql 分组后查询出排序字段
  7. 题解 AT859 【元素の系統名】
  8. 网格布局 grid(1)
  9. JDBC没有导入驱动jar包
  10. 3ds Max File Format (Part 1: The outer file format; OLE2)