事件轮播实例

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

<script  src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

<style>

*{

margin: 0;

padding: 0;

}

#img1{

height: 300px;

width: 400px;

position: absolute;

left: 500px;

top: 200px;

}

#img2{

height: 300px;

width: 400px;

position: absolute;

left: 500px;

top: 200px;

}

#img3{

height: 300px;

width: 400px;

position: absolute;

left: 500px;

top: 200px;

}

#p1{

height: 5px;

width: 5px;

border-radius: 5px;

position: absolute;

border:1px red solid;

top: 470px;

left: 830px;

}

#p1:hover{

background-color: white;

cursor: pointer;

}

#p2{

height: 5px;

width: 5px;

border-radius: 5px;

border: 1px red solid;

position: absolute;

top: 470px;

left: 845px;

}

#p2:hover{

background-color: white;

cursor: pointer;

}

#p3{

height: 5px;

width: 5px;

border-radius: 5px;

border:1px red solid;

position: absolute;

left: 860px;

top: 470px;

}

#p3:hover{

background-color: white;

cursor: pointer;

}

#b{

display: none;

}

#c{

display: none;

}

</style>

<script>

$(document).ready(function(){

$(function que(){

function showb(){

  $("#a").fadeOut(500);

  $("#b").fadeIn(500);

}

setTimeout(showb,3000);

function showc(){

$("#b").fadeOut(500);

$("#c").fadeIn(500);

}

setTimeout(showc,6000);

function showa(){

$("#c").fadeOut(500);

$("#a").fadeIn(500);

}

setTimeout(showa,9000);

setInterval(que,9000);

});

$("#p1").mouseover(function(){

$("#b").fadeOut(500);

$("#c").fadeOut(500);

$("#a").fadeIn(500);

});

$("#p2").mouseover(function(){

$("#c").fadeOut(500);

$("#a").fadeOut(500);

$("#b").fadeIn(500);

});

$("#p3").mouseover(function(){

$("#b").fadeOut(500);

$("#a").fadeOut(500);

$("#c").fadeIn(500);

});

});

</script>

</head>

<body>

<div id="img1">< img id="a" src="" width="400px" height="300px" alt=""></div>

<div id="img2">< img id="b" src="" width="400px" height="300px" alt=""></div>

<div id="img3">< img id="c" src="" width="400px" height="300px" alt=""></div>

<div id="p1"></div>

<div id="p2"></div>

<div id="p3"></div>

</body>

</html>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. tab列表折叠效果 html: 能源系统事业部 岗位名称: 工作地点 岗位名...
    lilyping阅读 5,891评论 0 1
  • 各种纯css图标 CSS3可以实现很多漂亮的图形,我收集了32种图形,在下面列出。直接用CSS3画出这些图形,要比...
    剑残阅读 13,293评论 0 8
  • 不会用代码框,所以看着有些乱套,,,,html部分 <!DOCTYPE html> 迅雷看看 ...
    这就是个帅气的名字阅读 5,498评论 0 0
  • http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
    love2013阅读 5,068评论 0 2
  • “原来你是我最想留住的幸运,原来我们和爱情曾经靠的那么近,与你相遇好幸运,可我已失去为你泪流满面的权利。” 一首《...
    长腿程阅读 2,682评论 0 2