forked from aui/artDialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalign.html
139 lines (133 loc) · 2.83 KB
/
align.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
#follow-elem {
width: 120px;
height: 120px;
position: absolute;
left: 50%;
margin-left: -60px;
top: 38%;
margin-top: -40px;
background: #e3f5ff;
border:1px solid #abd3ea;
border-radius: 6px;
}
#follow-elem input {
width: 14px;
height: 14px;
position: absolute;
cursor: pointer;
}
#follow-elem .nw {
left: 14px;
top: 0;
}
#follow-elem .n {
left: 50%;
margin-left: -7px;
top: 0;
}
#follow-elem .ne {
right: 14px;
top: 0;
}
#follow-elem .en {
right: 0;
top: 14px;
}
#follow-elem .e {
right: 0;
top: 50%;
margin-top: -7px;
}
#follow-elem .es {
right: 0;
bottom: 14px;
}
#follow-elem .se {
right: 14px;
bottom: 0;
}
#follow-elem .s {
left: 50%;
margin-left: -7px;
bottom: 0;
}
#follow-elem .sw {
left: 14px;
bottom: 0;
}
#follow-elem .ws {
left: 0;
bottom: 14px;
}
#follow-elem .w {
left: 0;
top: 50%;
margin-top: -7px;
}
#follow-elem .wn {
left: 0;
top: 14px;
}
code {
color: #888;
}
code strong {
color: #000;
}
</style>
</head>
<body>
<pre><code>var follow = document.getElementById('follow-elem');
var d = dialog({
align: '<strong id="test-align-value">bottom left</strong>',
content: 'hello world'
});
d.show(follow);</code></pre>
<div id="follow-elem">
<input type="radio" name="align" value="top left" class="nw" title="top left">
<input type="radio" name="align" value="top" class="n" title="top">
<input type="radio" name="align" value="top right" class="ne" title="top right">
<input type="radio" name="align" value="right top" class="en" title="right top">
<input type="radio" name="align" value="right" class="e" title="right">
<input type="radio" name="align" value="right bottom" class="es" title="right bottom">
<input type="radio" name="align" value="bottom right" class="se" title="bottom right">
<input type="radio" name="align" value="bottom" class="s" title="bottom">
<input type="radio" name="align" value="bottom left" class="sw" title="bottom left" checked>
<input type="radio" name="align" value="left bottom" class="ws" title="left bottom">
<input type="radio" name="align" value="left" class="w" title="left">
<input type="radio" name="align" value="left top" class="wn" title="left top">
</div>
<script src="../lib/sea.js"></script>
<script>
seajs.config({
alias: {
"jquery": "jquery-1.10.2.js"
}
});
</script>
<script>
seajs.use(['jquery', '../src/dialog'], function ($, dialog) {
var follow = $('#follow-elem')[0];
var d = dialog({
align: 'bottom left',
content: 'hello world'
});
d.show(follow);
$('#follow-elem').on('click', '[type=radio]', function () {
if (d.open) {
var align = $(this).val();
d.align = align;
d.show(follow);
$('#test-align-value').html(align);
}
});
});
</script>
</body>
</html>