原创原生态纯js单排图片自动滚动特效代码下载



如需定制开发(网站开发、二次开发)在线咨询,请点击>> QQ:753511799

28 109 37



特效描述:单排图片 自动滚动。原创原生态纯js单排图片自动滚动特效代码下载

代码结构

1. 引入CSS

<link href="css/goodteacher.css" type="text/css" rel="stylesheet" />
<link href="css/goodteacher.css" type="text/css" rel="stylesheet" />

2. HTML代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--sucai58.com 专注html3+css3素材的网站-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<script type="text/javascript">
window.onload = function () {
	var oBtnLeft = document.getElementById("goleft");
	var oBtnRight = document.getElementById("goright");
	var oDiv = document.getElementById("indexmaindiv");
	var oDiv1 = document.getElementById("maindiv1");
	var oUl = oDiv.getElementsByTagName("ul")[0];
	var aLi = oUl.getElementsByTagName("li");
	var now = -5 * (aLi[0].offsetWidth + 13);
	oUl.style.width = aLi.length * (aLi[0].offsetWidth + 13) + 'px';
	oBtnRight.onclick = function () {
		var n = Math.floor((aLi.length * (aLi[0].offsetWidth + 13) + oUl.offsetLeft) / aLi[0].offsetWidth);
		if (n <= 5) {
			move(oUl, 'left', 0);
		}
		else {
			move(oUl, 'left', oUl.offsetLeft + now);
		}
	}
	oBtnLeft.onclick = function () {
		var now1 = -Math.floor((aLi.length / 5)) * 5 * (aLi[0].offsetWidth + 13);
		if (oUl.offsetLeft >= 0) {
			move(oUl, 'left', now1);
		}
		else {
			move(oUl, 'left', oUl.offsetLeft - now);
		}
	}
	var timer = setInterval(oBtnRight.onclick, 5000);
	oDiv.onmouseover = function () {
		clearInterval(timer);
	}
	oDiv.onmouseout = function () {
		timer = setInterval(oBtnRight.onclick, 5000);
	}
};
function getStyle(obj, name) {
	if (obj.currentStyle) {
		return obj.currentStyle[name];
	}
	else {
		return getComputedStyle(obj, false)[name];
	}
}
function move(obj, attr, iTarget) {
	clearInterval(obj.timer)
	obj.timer = setInterval(function () {
		var cur = 0;
		if (attr == 'opacity') {
			cur = Math.round(parseFloat(getStyle(obj, attr)) * 100);
		}
		else {
			cur = parseInt(getStyle(obj, attr));
		}
		var speed = (iTarget - cur) / 6;
		speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
		if (iTarget == cur) {
			clearInterval(obj.timer);
		}
		else if (attr == 'opacity') {
			obj.style.filter = 'alpha(opacity:' + (cur + speed) + ')';
			obj.style.opacity = (cur + speed) / 100;
		}
		else {
			obj.style[attr] = cur + speed + 'px';
		}
	}, 30);
}  
</script>
</head>
<body style="background:#CCC;">
<div class="indexmaindiv" id="indexmaindiv">
	<div class="indexmaindiv1 clearfix" >
		<div class="stylesgoleft" id="goleft"></div>
		<div class="maindiv1 " id="maindiv1">
		<ul id="count1">
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/1.jpg" /></div>
					<div class="teanames">乐静老师1</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/2.jpg" /></div>
					<div class="teanames">乐静老师2</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/3.jpg" /></div>
					<div class="teanames">乐静老师3</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/4.jpg" /></div>
					<div class="teanames">乐静老师4</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/5.jpg" /></div>
					<div class="teanames">乐静老师5</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/6.jpg" /></div>
					<div class="teanames">乐静老师6</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/7.jpg" /></div>
					<div class="teanames">乐静老师7</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/8.jpg" /></div>
					<div class="teanames">乐静老师8</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/1.jpg" /></div>
					<div class="teanames">乐静老师9</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/2.jpg" /></div>
					<div class="teanames">乐静老师10</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/3.jpg" /></div>
					<div class="teanames">乐静老师11</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/4.jpg" /></div>
					<div class="teanames">乐静老师12</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/5.jpg" /></div>
					<div class="teanames">乐静老师13</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/6.jpg" /></div>
					<div class="teanames">乐静老师14</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/7.jpg" /></div>
					<div class="teanames">乐静老师15</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
			<li>
				<div class="playerdetail">
					<div class="detailimg"><img src="css/images/areabackground/8.jpg" /></div>
					<div class="teanames">乐静老师16</div>
					<div class="teadetail">获得新加坡南阳理工学院计算机学士学位擅长营销学培训</div>
					<a class="checkdetail" href="#"></a>
				</div>
			</li>
		</ul>
		</div>
		<div class="stylesgoright" id="goright"></div>
	</div>
</div>
</body>
</html> 



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滚动导航菜单 缩略图 滚动切换 图片相册 图片滚动 图片墙 文字滚动 百叶窗 图片网格 图片文字滚动 图片九宫格 全屏滚动 页面滚动 图片高亮 图片对比 图片文字 单排图片 响应式图片 图片列表 滚动流动 图片拖动 图片放大镜 图片叠加 图片翻转旋转 图片延迟加载 图片淡出淡进 图片全屏 图片头像上传 二维码 图片广告 图片放大缩小 html5图片动画 带缩略图的幻灯片 地图 图片滚动 图片滑动 图片切换 图片收缩展开 旋转木马 图片轮播 自动滚动图片轮播 图标导航菜单 背景切换 手风琴 图表 图片 头像截图

×
×
51前端

注册

×
绑定手机

请绑定手机号,在继续操作

×
单次下载支付

应付金额:279

支付完成后,回到下载页面,在进行下载

官方QQ群
意见反馈
qq群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到