js实现图片无缝轮播
2024-08-23 09:50:00
<!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>
最新文章
- git仓库的初始化
- C#基础-关于用json给控制台程序传值的坑
- atitit.web 推送实现方案集合(2)---百度云,jpush 极光推送 ,个推的选型比较.o99
- debug进入线程中
- 跟上节奏 大数据时代十大必备IT技能(转)
- 部署新浪SAE web.py Session及图片上传等问题注意事项
- 【BZOJ】【1565】【NOI2009】PVZ 植物大战僵尸
- Eclipse下Tomcat常用设置
- information_schema.referential_constraints 学习
- 《深入理解OSGi:Equinox原理、应用与最佳实践》笔记_1_运行最简单的bundlehelloworld
- Backbone视图渲染React组件
- 泛型里的super和extend
- ●UVA 1608 Non-boring sequences
- android开发之调试技巧
- 海量数据挖掘MMDS week5: 计算广告Computational Advertising
- 微信小程序 写一个获取验证码 及setInterval 使用基本方法
- Python——使用第三方库Pillow生成图片缩略图
- 抓取某网站信息时遇到的问题及解决 The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set
- MySQL参数最大连接数max_connections
- 1840: Jack Straws
热门文章
- SpringBoot整合WEB开发--(八)启动任务系统
- git配置多仓库
- Chrome浏览器控制台报Refused to get unsafe header ";XXX";的错误
- AcWing 1058. 股票买卖 V
- eclipse新建web项目,并将其部署到tomcat
- sql 分组后查询出排序字段
- 题解 AT859 【元素の系統名】
- 网格布局 grid(1)
- JDBC没有导入驱动jar包
- 3ds Max File Format (Part 1: The outer file format; OLE2)