This repository has been archived by the owner on Jul 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.html
82 lines (65 loc) · 2.27 KB
/
examples.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
<html>
<head>
<script src="lib/accessors.vbs" language="vbscript" charset="utf-8"></script>
<script src="lib/jquery-1.2.6.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/jquery-accessors.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/jquery-kvo.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="lib/examples.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<h1>jQuery KVO Examples</h1>
<div id="simple" class="example">
<h3>Simple Bindings</h3>
<p>
This bit is updated:
</p>
<!-- <example> -->
<div style="font-size:1.4em">
<b>Name:</b> <span bind="simple.name"></span>
</div>
<!-- </example> -->
<p>
When this textbox is changed:
</p>
<input type="text" id="simple-kvo-name" bind="simple.name" style="font-size:1.4em" />
<div class="html code">
Name: <span bind="simple.name"></span>
</div>
<script type="text/javascript" charset="utf-8">
var simple = $.kvo.build({name: "Frank"});
$('#simple-kvo-name').bind('keyup', function() {
simple.name = $(this).val();
});
</script>
</div>
<div id="visibility" class="example">
<h3>Binding Visibility</h3>
<p>
This is only visible:
</p>
<!-- <example> -->
<div style="font-size:1.4em; color:red" bind="visi.visible" bind-to="visible">
HELLO
</div>
<!-- </example> -->
<p>
When this is checked:
</p>
<label>
<input type="checkbox" id="visi-checkbox" bind="visi.visible" /> Visible?
</label>
<div class="html code">
<div bind="visi.visible" bind-to="visible"><br/>
HELLO<br/>
</div>
</div>
<script type="text/javascript" charset="utf-8">
var visi = $.kvo.build({visible: true});
$('#visi-checkbox').bind('click', function() {
visi.visible = $(this).attr('checked');
});
</script>
<div class="html"></div>
</div>
</body>
</html>