add editable example
This commit is contained in:
parent
5b5a133533
commit
392a700d19
3 changed files with 61 additions and 0 deletions
11
examples/forms/editable_elements/css/example.css
Normal file
11
examples/forms/editable_elements/css/example.css
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#box {
|
||||||
|
width: 512px;
|
||||||
|
margin: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
div.label {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
14
examples/forms/editable_elements/index.html
Normal file
14
examples/forms/editable_elements/index.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Editable Elements</title>
|
||||||
|
<meta http-equiv="Keywords" content="Forms"/>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="../../../source/Ox.UI/themes/oxlight/png/icon16.png"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/example.css"/>
|
||||||
|
<script type="text/javascript" src="../../../build/Ox.js"></script>
|
||||||
|
<script type="text/javascript" src="js/example.js"></script>
|
||||||
|
<script>window.addEventListener('message', function(e) { e.origin == window.location.origin && eval(e.data); });</script>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
36
examples/forms/editable_elements/js/example.js
Normal file
36
examples/forms/editable_elements/js/example.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
This example shows elements that are editable inline — either a span or a
|
||||||
|
div.
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Ox.load('UI', function() {
|
||||||
|
|
||||||
|
var $box = Ox.Element()
|
||||||
|
.attr({id: 'box'})
|
||||||
|
.appendTo(Ox.$body);
|
||||||
|
|
||||||
|
Ox.loop(1, 4, function(i) {
|
||||||
|
Ox.$('<span>')
|
||||||
|
.addClass('label')
|
||||||
|
.html((i > 1 ? ' ' : '') + 'Editable ' + i + ': ')
|
||||||
|
.appendTo($box);
|
||||||
|
Ox.EditableContent({
|
||||||
|
placeholder: 'Placeholder ' + i,
|
||||||
|
tooltip: 'Doubleclick to edit'
|
||||||
|
})
|
||||||
|
.appendTo($box);
|
||||||
|
});
|
||||||
|
|
||||||
|
Ox.$('<div>')
|
||||||
|
.addClass('label')
|
||||||
|
.html('Editable 4:')
|
||||||
|
.appendTo($box);
|
||||||
|
Ox.EditableContent({
|
||||||
|
placeholder: 'Placeholder 4',
|
||||||
|
tooltip: 'Doubleclick to edit',
|
||||||
|
type: 'div'
|
||||||
|
})
|
||||||
|
.appendTo($box);
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in a new issue