-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (50 loc) · 1.24 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Example Comfey bind-class</title>
</head>
<body>
<div id="app">
<h1>Comfey Example - Bind Class</h1>
<div>
<h2>Simple boolean binding with static string class</h2>
<div class="active-check" data-bind-class="stateActive::active">
Green if active
</div>
</div>
<div>
<h2>Static class binding with value comparison</h2>
<div
class="dynamic-class-check"
data-bind-class="fontSize::large::large"
>
Font size changes with the state fontSize
</div>
</div>
</div>
<br />
<hr />
<em
>Note: Use `bind-attr` if you need dynamic value to an attribute, since
classList can take multivalue, its not recommend to manage dynamic
value.</em
>
<style>
.active-check {
color: red;
}
.active {
color: green;
}
.dynamic-class-check {
font-size: 16px;
}
.dynamic-class-check.large {
font-size: 36px;
}
</style>
<script src="./index.js"></script>
</body>
</html>