2017.12.5
来源:互联网 发布:php post接口开发 编辑:程序博客网 时间:2024/06/06 05:58
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>轮播</title>
<style>
#wrap{
margin:0;
position:relative;
height:100vmin;
width:100vw;
background:#33FFCC;
}
#wrapout{
position:absolute;
width:700px;
height:300px;
left:600px;
top:650px;
background:#FFFFFF;
}
#slider{
position:inherit;
width:700px;
height:300px;
}
img{
opacity:0;
position:inherit;
}
#item{
width:690px;
height:30px;
position:inherit;
bottom:0px;
text-align:right;
}
span{
width:30px;
height:15px;
margin:0px;
display:inline-block;
background:#ccc;
}
span:hover{
cursor:pointer;
}
</style>
</head>
<body>
<div id="wrap">
<div id="wrapout">
<div id="slider">
<img src="img/1.png" height="300" width="700" alt="冒险岛" />
<img src="img/2.png" height="300" width="700" alt="冒险岛" />
<img src="img/3.png" height="300" width="700" alt="冒险岛" />
</div>
<div id="item">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<script>
var j = 0;
var timer = null;
onload = handSlide();
slide();
function handSlide(){
var spans = document.getElementsByTagName("span");
var imgs = document.getElementsByTagName("img");
spans[0].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[0].style.background = "#FFA500";
imgs[0].style.opacity = 1;
}
spans[1].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[1].style.background = "#FFA500";
imgs[1].style.opacity = 1;
}
spans[2].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[2].style.background = "#FFA500";
imgs[2].style.opacity = 1;
}
wrapout.onmouseover = function(){ clearInterval(timer); }
wrapout.onmouseout = function(){ timer = setInterval("changeImg()",3000); }
/*for(var num = 0;num<3;num++){
var span = document.getElementsByTagName("span")[num];
span.onmouseover = function(){ span.style.background = "red"; }
span.onmouseout = function(){ span.style.background = "#ccc"; }
}*/
}
function slide(){
changeImg();
timer = setInterval("changeImg()",3000);
}
function changeImg(){
var i,s;
for(var k = 0;k<3;k++){ //清除之前的打开的透明值
i = document.getElementsByTagName("img")[k];
s = document.getElementsByTagName("span")[k];
i.style.opacity = 0;
s.style.background = "#ccc";
}
j %= 3;
i = document.getElementsByTagName("img")[j];
s = document.getElementsByTagName("span")[j];
i.style.opacity = 1;
s.style.background = "#FFA500";
j++;
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>轮播</title>
<style>
#wrap{
margin:0;
position:relative;
height:100vmin;
width:100vw;
background:#33FFCC;
}
#wrapout{
position:absolute;
width:700px;
height:300px;
left:600px;
top:650px;
background:#FFFFFF;
}
#slider{
position:inherit;
width:700px;
height:300px;
}
img{
opacity:0;
position:inherit;
}
#item{
width:690px;
height:30px;
position:inherit;
bottom:0px;
text-align:right;
}
span{
width:30px;
height:15px;
margin:0px;
display:inline-block;
background:#ccc;
}
span:hover{
cursor:pointer;
}
</style>
</head>
<body>
<div id="wrap">
<div id="wrapout">
<div id="slider">
<img src="img/1.png" height="300" width="700" alt="冒险岛" />
<img src="img/2.png" height="300" width="700" alt="冒险岛" />
<img src="img/3.png" height="300" width="700" alt="冒险岛" />
</div>
<div id="item">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<script>
var j = 0;
var timer = null;
onload = handSlide();
slide();
function handSlide(){
var spans = document.getElementsByTagName("span");
var imgs = document.getElementsByTagName("img");
spans[0].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[0].style.background = "#FFA500";
imgs[0].style.opacity = 1;
}
spans[1].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[1].style.background = "#FFA500";
imgs[1].style.opacity = 1;
}
spans[2].onmouseover = function(){
for(var index=0;index<spans.length;index++)
{ spans[index].style.background = "#ccc";
imgs[index].style.opacity = 0; }
spans[2].style.background = "#FFA500";
imgs[2].style.opacity = 1;
}
wrapout.onmouseover = function(){ clearInterval(timer); }
wrapout.onmouseout = function(){ timer = setInterval("changeImg()",3000); }
/*for(var num = 0;num<3;num++){
var span = document.getElementsByTagName("span")[num];
span.onmouseover = function(){ span.style.background = "red"; }
span.onmouseout = function(){ span.style.background = "#ccc"; }
}*/
}
function slide(){
changeImg();
timer = setInterval("changeImg()",3000);
}
function changeImg(){
var i,s;
for(var k = 0;k<3;k++){ //清除之前的打开的透明值
i = document.getElementsByTagName("img")[k];
s = document.getElementsByTagName("span")[k];
i.style.opacity = 0;
s.style.background = "#ccc";
}
j %= 3;
i = document.getElementsByTagName("img")[j];
s = document.getElementsByTagName("span")[j];
i.style.opacity = 1;
s.style.background = "#FFA500";
j++;
}
</script>
</body>
</html>
阅读全文
0 0
- 2017.12.5
- 【2017.12.5】退役了。。
- 2017.12.5项目
- 每日一记:2017.12.5
- 【2017.12.5】6.ZigZag Conversion(曲折转换)
- 2017.12.5对内网,外网的理解
- 武汉工程科技学院.网络集成与安全.综合实习报告.2017.12.5
- 2017.12.01
- 2017.12.3
- 2017.12.3
- 2017.12.4
- 2017.12.6
- 2017.12.6
- 2017.12.7
- 2017.12.07
- 2017.12.7
- 2017.12.7
- 2017.12.7
- VS 2015 + QT 5.6.0的开发环境配置文档说明
- Git Bash常用命令
- (Linux Issue) E: Problem executing scripts APT::Update::Post-Invoke-Success [duplicate]
- Spring Boot整合Mybatis
- 给数组赋随机数
- 2017.12.5
- HDU2014青年歌手大奖赛_评委会打分
- 搭建简单的Restful风格的web服务
- 在 tomcat 下 请求参数的乱码问题
- 工作日常--event对象总结
- Spring源码
- Ubuntu 16.04展开海思平台Hi3536的SDK包错误解决
- 归一化特征值
- Apache hive安装