Skip to content

Commit e4995ac

Browse files
committed
Add form expose demo
1 parent adf672b commit e4995ac

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

test/toolbox/expose.html

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!DOCTYPE html>
2+
<html lang=en>
3+
<head>
4+
<title>jQuery Tools standalone demo</title>
5+
6+
<script src="../js/jquery-1.6.2.js"></script>
7+
<script src="../../src/toolbox/toolbox.expose.js"></script>
8+
9+
<style type="text/css">
10+
.wrap {
11+
position: relative;
12+
width: 395px;
13+
margin: 0 auto;
14+
margin-top: 50px;
15+
/*border: 1px dotted #cccccc;*/
16+
}
17+
18+
form.expose {
19+
border: 1px outset #ccc;
20+
background: #fff url('http://www.tribalmystic.com/tools/img/global/h150.png') repeat-x;
21+
padding: 20px;
22+
margin: 20px 0;
23+
text-align:center;
24+
width: 350px;
25+
-moz-border-radius: 4px;
26+
-webkit-border-radius: 4px;
27+
border-radius:4px;
28+
}
29+
30+
/* http://www.quirksmode.org/css/forms.html */
31+
label, input {
32+
display: block;
33+
width: 150px;
34+
float: left;
35+
margin-bottom: 10px;
36+
}
37+
38+
label {
39+
text-align: right;
40+
width: 75px;
41+
padding-right: 20px;
42+
}
43+
44+
br {
45+
clear: left;
46+
}
47+
48+
p {
49+
font-size: 1.4em;
50+
}
51+
</style>
52+
53+
</head>
54+
<body>
55+
56+
<div class="wrap">
57+
58+
<form class="expose">
59+
<label for="username">Username</label>
60+
<input id="username" /><br/>
61+
<label for="password">Password</label>
62+
<input id="password" type="password" /><br/>
63+
</form>
64+
65+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel velit sed sapien sollicitudin ultricies ornare ac ipsum</p>
66+
67+
</div>
68+
</body>
69+
70+
<script type="text/javascript">
71+
$(function(){
72+
73+
// expose the form when it's clicked or cursor is focused
74+
var form = $(".expose").bind("click keydown", function() {
75+
76+
$(this).expose({
77+
78+
// when exposing is done, change form's background color
79+
onLoad: function() {
80+
form.css({backgroundColor: '#c7f8ff'});
81+
},
82+
83+
// when "unexposed", return to original background color
84+
onClose: function() {
85+
form.css({backgroundColor: ''});
86+
}
87+
});
88+
});
89+
90+
});
91+
</script>
92+
93+
</html>

0 commit comments

Comments
 (0)