-
Notifications
You must be signed in to change notification settings - Fork 50
/
index4.html
56 lines (55 loc) · 1.88 KB
/
index4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery无缝滚动插件</title>
<style type="text/css">
*{margin:0; padding: 0;}
ul{list-style: none;}
.nav{max-width: 800px; margin: 0 auto; padding:20px 0; display: flex; flex-flow:row wrap; justify-content:space-around; border-bottom: 1px solid #ddd;}
.nav a{font-size: 14px; color: #333; text-decoration: none;}
.nav a:hover, .nav .current{color: #f00; text-decoration: underline;}
.a{height: 200px; width:800px; overflow: hidden; margin:10px auto;}
.a li{height: 198px; width: 198px; border:1px solid #ddd; line-height: 2.4; font-size: 30px; text-align: center; float: left;}
</style>
</head>
<body>
<div class="nav"><a href="https://qdkfweb.cn/">前端博客</a><a href="https://qdkfweb.cn/scrollForever" target="blank">插件使用介绍</a><a href="index.html">无缝滚动插件版</a><a href="index1.html">无缝向左1</a><a href="index2.html">无缝向左2</a><a href="index3.html">无缝向上</a><a href="index4.html" class="current">间断向左</a><a href="index5.html">间断向上</a></div>
<div class="a">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
</ul>
</div>
<script src="js/jquery.js"></script>
<script type="text/javascript">
var obj = $('.a');
var ul = obj.find('ul');
var li = ul.find('li');
var w = li.size() * li.outerWidth();
ul.css('width',2*w);
function autoScroll(){
ul.animate({marginLeft:"-200px"},1000,function(){
ul.css({marginLeft:0}).find('li:first').appendTo(ul);
});
}
var scrolling = setInterval(autoScroll,2000);
obj.hover(function(){
clearInterval(scrolling);
},function(){
scrolling = setInterval(autoScroll,2000);
})
</script>
<script type="text/javascript" src="https://qdkfweb.cn/demo/base.js" charset="UTF-8"></script>
</body>
</html>