-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
47 lines (45 loc) · 1.43 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>x-enterleave.js</title>
<link rel="stylesheet" href="css/styles.css">
<script src="./dist/jquery.min.js"></script>
<script src="./dist/x-enterleave.min.js"></script>
</head>
<body>
<div class="container">
<h1 class="header">x-enterleave.js</h1>
<div x-enterleave class="box"></div>
<div x-enterleave class="box box--c1"></div>
<div x-enterleave class="box box--c2"></div>
<div x-enterleave class="box box--c3"></div>
<div x-enterleave class="box box--c4"></div>
<div x-enterleave class="box box--c5"></div>
</div>
<a class="github" href="https://github.com/jfroffice/x-enterleave.js">
<img src="./img/forkme.png" alt="Fork me on GitHub">
</a>
<div class="toolbar">
<a class="btn js-btn" data-param="add">add</a>
<a class="btn js-btn" data-param="remove">remove</a>
</div>
<script>
var action = {
add: function() {
var $element = $('<div />');
$element
.addClass('box box--c' + ($('.box').length) % 6)
.attr('x-enterleave', '');
$('.container').append($element);
},
remove: function() {
$('.container .box:first').remove();
}
}
$('.js-btn').on('click', function() {
action[ $(this).data('param')]();
});
</script>
</body>
</html>