-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·82 lines (73 loc) · 2.13 KB
/
index.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
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>show hide number of elements per click</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/css.css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/showHideEl.js"></script>
</head>
<body>
<ul class="mylist">
<li class="title">
List one
</li>
<li class="el">1</li>
<li class="el">2</li>
<li class="el">3</li>
<li class="el">4</li>
<li class="el">5</li>
<li class="el">6</li>
<li class="el">7</li>
<li class="el">8</li>
<li class="el">9</li>
<li class="el">10</li>
<li class="buttons">
<div class="btn show">Show</div>
<div class="btn hide">Hide</div>
</li>
</ul>
<ul class="mylist">
<li class="title">
List two
</li>
<li class="el">1</li>
<li class="el">2</li>
<li class="el">3</li>
<li class="el">4</li>
<li class="el">5</li>
<li class="el">6</li>
<li class="el">7</li>
<li class="el">8</li>
<li class="el">9</li>
<li class="el">10</li>
<li class="buttons">
<div class="btn show">Show</div>
<div class="btn hide">Hide</div>
</li>
</ul>
</body>
<script type="text/javascript">
jQuery(document).on({
ready: function() {
jQuery(document.getElementsByClassName('mylist')).each(function() {
var mylist = this;
showhide.initEl(mylist, '.el', 1);
jQuery(mylist).find('.show').on({
click: function(e) {
e.preventDefault();
showhide.showEl(mylist, '.el', 1);
}
});
jQuery(mylist).find('.hide').on({
click: function(e) {
e.preventDefault();
showhide.hideEl(mylist, '.el', 1);
}
});
});
}
});
</script>
</html>