-
Notifications
You must be signed in to change notification settings - Fork 50
/
index5.html
70 lines (69 loc) · 2.58 KB
/
index5.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!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;}
.b{height: 400px; overflow: hidden; width: 200px; margin-left:auto; margin-right: auto;}
.b-con div{width: 198px; height: 198px; border: 1px solid #ddd; line-height: 2.4; font-size: 30px; text-align: center;}
</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">间断向左</a><a href="index5.html" class="current">间断向上</a></div>
<div class="b">
<div class="b-con">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script type="text/javascript">
jQuery.fn.extend({
marqueeTop:function (options){
var defaults = {container:"ul",inner:"li",placeholder:0}
var opts = $.extend({}, defaults,options);
$(this).each(function(){
var obj = $(this);
var ul = obj.find(opts.container);
var li = ul.find(opts.inner);
var placeholder = opts.placeholder == 0 ? li.outerHeight() : opts.placeholder;
var w = (li.size() +1) * li.outerHeight();
ul.css('height',w);
function autoScroll(){
ul.animate({marginTop:'-'+placeholder},1000,function(){
ul.css({marginTop:0}).find(opts.inner+':first').appendTo(ul);
});
}
var scrolling = setInterval(autoScroll,2000);
obj.hover(function(){
clearInterval(scrolling);
},function(){
scrolling = setInterval(autoScroll,2000);
});
});
}
});
$(function(){
$(".b").marqueeTop({container:".b-con",inner:"div",placeholder:'200px'});
});
</script>
<script type="text/javascript" src="https://qdkfweb.cn/demo/base.js" charset="UTF-8"></script>
</body>
</html>