-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
54 lines (43 loc) · 1.28 KB
/
test.html
File metadata and controls
54 lines (43 loc) · 1.28 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TypeScript HTML App</title>
<link rel="stylesheet" href="app.css" type="text/css" />
</head>
<body>
<h1>bx Test Page</h1>
<h2>Keep on Clicking on These Items</h2>
<ul id="ul1">
<li>Click Item 1</li>
<li>Click Item 2</li>
<li>Click Item 3</li>
</ul>
<button id="btn1">Add Item</button>
<div id="content"></div>
<script src="barix.js"></script>
<script>
//apply some style
bx('h2').css({
"text-decoration": "underline",
"color": "violet"
});
//static binding
bx('#btn1').on('click', function () {
bx('#ul1').append('<li>New Click Item</li>');
});
//dynamic binding
bx('#ul1').on('click', 'li', function () {
var color = getRandomColor();
bx(this).css('background', color);
});
function getRandomColor() {
var r = Math.floor(Math.random() * 255);
var g = Math.floor(Math.random() * 255);
var b = Math.floor(Math.random() * 255);
var color = 'rgb(' + r + ',' + g + ',' + b + ')';
return color;
}
</script>
</body>
</html>