淘宝大图滚动小例子
来源:互联网 发布:魔法王座怒炮进阶数据 编辑:程序博客网 时间:2024/04/28 21:21
<!DOCTYPE html>
<html>
<head>
<metacharset="UTF-8">
<title></title>
<styletype="text/css">
*{
margin:0;
padding:0;
}
.banner{
width:520px;
height:280px;
overflow:hidden;
position:relative;
}
ul{
list-style:none;
width:3640px;
height:280px;
position:absolute;
left:-520px;
top:0;
}
li{
float:left;
}
.banner>a{
position:absolute;
top:50%;
width:24px;
background-color:#222222;
opacity:0.45;
margin-top:-28px;
height:56px;
color:#fff;
text-align: center;
line-height:56px;
}
#last{
left:0;
}
#next{
right:0;
}
.banner>div>a{
text-decoration:none;
width:10px;
border-radius:50%;
background-color:#222222;
height:10px;
margin:0 2px;
float:left;
}
.banner>div{
width:70px;
position:absolute;
bottom:12px;
left:0;
right:0;
margin:0 auto;
z-index:1;
}
</style>
</head>
<body>
<divclass="banner">
<ulclass="bnn">
<li><imgsrc="img/55.jpg" alt="" /></li>
<li><imgsrc="img/11.jpg" alt="" /></li>
<li><imgsrc="img/22.jpg" alt="" /></li>
<li><imgsrc="img/33.jpg" alt="" /></li>
<li><imgsrc="img/44.jpg" alt="" /></li>
<li><imgsrc="img/55.jpg" alt="" /></li>
<!--<li><img src="img/11.jpg" alt="" /></li>-->
</ul>
<ahref="javascript:void(0);"id="last"><</a>
<ahref="javascript:void(0);"id="next">></a>
<divclass="controls">
<ahref="javascript(void)" style="background-color:#FF4400;" ></a>
<ahref="javascript(void)"></a>
<ahref="javascript(void)"></a>
<ahref="javascript(void)"></a>
<ahref="javascript(void)"></a>
</div>
</div>
<scriptsrc="js/move-1.js" type="text/javascript" charset="utf-8"></script>
<scripttype="text/javascript">
varaList = document.querySelectorAll("li");
var oBnn = document.querySelector(".bnn");
var oLast = document.querySelector("#last");
var oNext = document.querySelector("#next");
var aBtn = document.querySelectorAll(".controls>a");
var i = 1;
var timer = null;
var direction = true;
functionAutoAct() {
clearInterval(timer);
timer = setInterval(function() {
//if(i >= 5){
//i = 0;
//oBnn.style.left = 0;
//}
//move(oBnn,{left:-520*(i+1)});
//for(var j=0; j<aBtn.length; j++){
//aBtn[j].style.backgroundColor = "#222222";
//}
//
//aBtn[i].style.backgroundColor = "#FF4400";
//i++;
//},1000);
//i++;
for(varj=0; j<aBtn.length; j++){
aBtn[j].style.backgroundColor= "#222222";
}
j++;
if(i === 5) {
i= 0;
oBnn.style.left= 0 + "px";
}
aBtn[i].style.backgroundColor= "#FF4400";
move(oBnn, {left:-520 * ++i});
}, 1000);
}
AutoAct();
for (var m = 0; m< aBtn.length; m++) {
aBtn[m].index = m;
aBtn[m].onmouseover= function() {
i = this.index;
for(var j = 0; j< aBtn.length; j++) {
aBtn[j].style.backgroundColor= "#222222";
}
move(oBnn, {
left:-520 * (i + 1)
});
aBtn[i].style.backgroundColor= "#FF4400";
}
}
oLast.onclick= function(){
clearInterval(timer);
i--;
if(i== -1){
i= 4;
oBnn.style.left= -3120 + "px";
}
move(oBnn,{left:-520*(i+1)});
for(varj=0; j<aBtn.length; j++){
aBtn[j].style.backgroundColor= "#222222";
}
aBtn[i].style.backgroundColor= "#FF4400";
AutoAct();
}
oNext.onclick= function(){
clearInterval(timer);
i++;
if(i>= 5){
i= 0;
oBnn.style.left= 0;
}
move(oBnn,{left:-520*(i+1)});
for(varj=0; j<aBtn.length; j++){
aBtn[j].style.backgroundColor= "#222222";
}
aBtn[i].style.backgroundColor= "#FF4400";
AutoAct();
}
//oLast.onclick = function(){
//i--;
//if(i <= 0){
//oBnn.style.left = -3120 + "px";
//i = 0;
//}
//move(oBnn,{left: oBnn.offsetLeft + (aList[0].offsetWidth)});
//};
//
//oNext.onclick = function(){
//i++;
//if(i >= 5){
//oBnn.style.left = 0 + "px";
//i = 0;
//}
//move(oBnn,{left: oBnn.offsetLeft - (aList[0].offsetWidth)});
//};
//
//for(var i=0; i<aBtn.length; i++){
//aBtn[i].onmouseover = function(){
//
//}
//}
//
//
//var timer = null;
//var i = 0;
//
//timer = setInterval(function(){
////clearInterval(timer);
//i++;
//if(i == 5){
//oBnn.style.left = 0 + "px";
//i = 0;
//}
//move(oBnn,{left: oBnn.offsetLeft - (aList[0].offsetWidth)});
//for(var j=0; j>aBtn.length; j++){
//aBtn[j].style.backgroundColor = "";
//}
//aBtn[i]
//},1000);
//i++;
//move(oBnn,{left:-520*i});
//if(i == 6){
//i = 1;
//oBnn.style.left = 0;
//}
</script>
</body>
</html>
<!--//正滚动的时候把数改了,这句话(函数的定时器)在if之后执行完,所以if之后left是move();之后的-->
- 淘宝大图滚动小例子
- 淘宝大图滚动
- 淘宝大图
- JS点击小图预览大图(仿淘宝)
- 大图滚动
- 大图滚动
- 大图滚动
- 大图滚动
- 大图滚动
- jquery小图片左右滚动点击小图切换显示大图
- 实现大图滚动显示
- 188,查看滚动大图
- 无间断大图滚动
- tweenjs大图滚动
- 怎么下载淘宝商品大图
- ecshop首页滚动仿京东全球购大图配2小图
- android_背景大图滚动播放
- 创建滚动条浏览大图
- html标签
- 任意运动框架
- ASP.NET正则表达式提取网页网址、标题、图片实例以及过滤所有HTML标签实例
- move.js
- VS.NET 2003集成环境插件开发指南(一)----操纵菜单
- 淘宝大图滚动小例子
- 勾股定理一日一证连载49
- VS.NET 2003集成环境插件开发指南(二)----使用窗口
- js基础
- default browser
- Thinking in Java 第15章 泛型(15.1-15.4)
- TYVJ 2009 Lagoon
- VS.NET 2003集成环境插件开发指南(三)----操纵VS开发环境(完结篇)
- js实现加减乘除