-
Notifications
You must be signed in to change notification settings - Fork 0
/
knockout-example.html
38 lines (28 loc) · 1.67 KB
/
knockout-example.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
<html>
<head>
<title>gutruncate - knockout demo</title>
</head>
<body>
<textarea data-bind="value: myText, valueUpdate: 'afterkeydown'"></textarea>
<hr>
<p data-bind="gutruncate: myText"></p>
<hr>
<div>
<button id="external-toggle">Toggle</button>
<p data-bind="gutruncate: { text: myText, options: { externalToggle: '#external-toggle' } }"></p>
</div>
<hr>
<p data-bind="gutruncate: { text: myText, options: { togglePosition: 'top' } }"></p>
<hr>
<p data-bind="gutruncate: { text: myText, options: { minLength: 0, tolerance: 0, ellipsisText: '', readMoreText: 'Show message', readLessText: 'Hide message', togglePosition: 'top' } }"></p>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.0.0.js"></script>
<script src="gutruncate.js"></script>
<script>
var viewModel = {
myText: ko.observable("Ah'll box thi ears gerritetten t'foot o' our stairs michael palin is that thine a pint 'o mild. Gerritetten. Aye what's that when it's at ooam tha daft apeth by 'eck any rooad ah'll box thi ears. Ah'll gi' thee a thick ear tha daft apeth aye soft lad. Wacken thi sen up. A pint 'o mild how much ah'll gi' thi summat to rooer abaht. Bloomin' 'eck t'foot o' our stairs. Breadcake. Tha knows tha daft apeth be reet ne'ermind michael palin any rooad. Aye th'art nesh thee how much. Ah'll box thi ears ee by gum shurrup bobbar appens as maybe what's that when it's at ooam. Tha daft apeth wacken thi sen up bloomin' 'eck wacken thi sen up gi' o'er. Is that thine. How much. Michael palin ne'ermind mardy bum.")
};
ko.applyBindings(viewModel);
</script>
</body>
</html>