js中实现图片轮播

前段时间领导要求给公司做一个简单的员工薪资查询APP,在首页面中想做一个图片轮播,放一些公司平常活动的图片,现在总结记录一下 :活不多说,直接上代码 

JS:

CSS: 

* {
	margin: 0px;
	text-decoration: none;
}

.imglb{
	width: 360px;
	height: 220px;
}

#container {
	width: 360px;
	height: 220px;
	position: relative;
	border: 1px solid #333;
	overflow: hidden;
	margin: 0 auto;
}

#list {
	width: 3920px;
	height: 220px;
	position: absolute;
	z-index: 1;
}

#list img {
	float: left;
}

#buttons {
	position: absolute;
	height: 10px;
	/* width: 100px; */
	z-index: 2;
	bottom: 3%;
	left: 50%;
}

#buttons span {
	cursor: pointer; /*假超链接样式*/
	float: left;
	border: 1px solid #fff;
	width: 10px;
	height: 10px;
	border-radius: 10px;
	background: #333;
	margin-right: 5px;
}

#buttons .on {
	background: orangered;
}

.arrow {
	cursor: pointer;
	display: none;
	line-height: 39px;
	text-align: center;
	font-size: 36px;
	font-weight: bold;
	width: 40px;
	height: 40px;
	position: absolute;
	z-index: 2;
	top: 90px;
	background-color: RGBA(0, 0, 0, .3);
	color: #fff;
}

.arrow:hover {
	background-color: RGBA(0, 0, 0, .7);
}

#container:hover .arrow {
	display: block;
}

#prev {
	left: 20px;
}

#next {
	right: 20px;
}
5.pg 5.pg 5.pg 5.pg 5.pg 5.pg 5.pg 5.pg 5.pg 5.pg 5.pg

最后放到手机上看了一下效果挺好的,主要注意的地方就是位移量算好就可以了

你可能感兴趣的:(cordova,android,图片轮播,软件开发开发)