<!DOCTYPE html>
<html> <head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
list-style: none;
} div>span {
margin-top: 30px;
background: #e0e0e0;
color: red;
font-size: 25px;
width: 50px;
height: 30px;
line-height: 30px;
text-align: center;
display: inline-block;
margin-right: 3px;
font-weight: bolder;
cursor: pointer;
} nav {
margin-top: 30px;
width: 600px;
height: 300px; overflow: hidden;
position: relative;
} ul {
width: 8888px;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
} ul>li {
width: 200px;
height: 100%;
background: #FF6700;
float: left;
font-size: 40px;
color: #fff;
text-align: center;
line-height: 300px;
} li:nth-of-type(2) {
background: gray;
} li:nth-of-type(3) {
background: red;
} li:nth-of-type(4) {
background: green;
} li:nth-of-type(5) {
background: cornflowerblue;
} li:nth-of-type(6) {
background: gold;
}
</style>
</head> <body>
<div><span class="left"><</span><span class="right">></span></div>
<nav>
<ul>
<li>AAAA</li>
<li>BBBB</li>
<li>CCCC</li>
<li>DDDD</li>
<li>EEEE</li>
<li>FFFF</li>
</ul>
</nav>
<script type="text/javascript">
var ul = document.querySelector("ul");
var left = document.querySelector(".left");
var right = document.querySelector(".right"); var i = 0,
timer, timer2,timer3,timer4;
LEFT();
function LEFT() {
clear();
function move1() {
i -= 40;
if(i <= -600) {
clearInterval(timer);
i = -600;
timer4=setTimeout(RIGHT, 5500);
}
ul.style.left = i + "px";
}
timer = setInterval(move1, 10)
} function RIGHT() {
clear();
function move2() {
i += 40;
if(i >= 0) {
i = 0;
clearInterval(timer2);
timer3=setTimeout(LEFT, 5500);
}
ul.style.left = i + "px";
}
timer2 = setInterval(move2, 10);
} left.onclick=function(){
clear();
LEFT(); }
right.onclick=function(){
clear();
RIGHT(); }
function clear(){
if(timer){
clearInterval(timer)
}
if(timer2){
clearInterval(timer2)
}
if(timer3){
clearTimeout(timer3)
}
if(timer4){
clearTimeout(timer4)
}
}
</script>
</body> </html>

最新文章

  1. 【编辑器】【Sublime Text】使用笔记
  2. HEVC学习之二CTU, CU, CTB, CB, PB, TB
  3. 栈的存储结构和常见操作(c 语言实现)
  4. android常用的弹出提示框
  5. [oracle] 解决X64操作系统PL/SQL连接报错问题 make sure you have the 32 bits oracle client installed
  6. c#中如何得到百分比数值
  7. ASP.NET缓存OutputCache和Response.Cache之C#后台设置
  8. Flash AIR 保存与读取
  9. LeeCode(Database)-Customers Who Never Order
  10. python编写工具及配置(notepad++)
  11. perl json模块
  12. hdu4770:Lights Against Dudely(回溯 + 修剪)
  13. python matplotlib 图表局部放大
  14. Ubuntu 16.04 LTS运行robo3t报错
  15. 【机器学习】正则化的线性回归 —— 岭回归与Lasso回归
  16. UNIX网络编程——客户/服务器程序设计示范(四)
  17. 【bzoj 1407】【Noi2002】Savage
  18. ASCII记录
  19. 微信小程序内嵌网页的一些(最佳)实践
  20. 00、Word Count

热门文章

  1. Ubuntu14.04 Anaconda
  2. 【ACM-ICPC 2018 南京赛区网络预赛 A】An Olympian Math Problem
  3. 【hdu 6406】Taotao Picks Apples
  4. Vijos——T 1016 北京2008的挂钟 || 洛谷—— P1213 时钟
  5. 为屏而生,为屏而死 - IT &amp;quot;精英”们的杯与具
  6. VMware-workstation安装
  7. 【scikit-learn】交叉验证及其用于參数选择、模型选择、特征选择的样例
  8. ubuntu中不能远程连接解决
  9. Ubuntu下推荐安装软件
  10. thinkphp连接数据库,会有大量的sleep连接