回答編集履歴
2
e
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
単純な問題で、IDの重複です。
|
1
|
+
単純な問題で、ID: #open2 の重複です。
|
2
|
+
|
3
|
+
これでコピペすれば動きます.
|
2
4
|
|
3
5
|
--------------------------
|
4
6
|
|
1
matigae
test
CHANGED
@@ -126,96 +126,90 @@
|
|
126
126
|
|
127
127
|
</div>
|
128
128
|
|
129
|
-
|
129
|
+
<script>
|
130
|
+
|
131
|
+
(function($) {
|
132
|
+
|
133
|
+
$.fn.ipop = function() {
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
var $this = $(this);
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
var wx, wy; // ウインドウの左上座標
|
142
|
+
|
143
|
+
var mx, my; // マウスの座標
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
// ウインドウの座標を画面中央にする。
|
148
|
+
|
149
|
+
wx = $(document).scrollLeft() + ($(window).width() - $(this).outerWidth()) / 2;
|
150
|
+
|
151
|
+
if (wx < 0) wx = 0;
|
152
|
+
|
153
|
+
wy = $(document).scrollTop() + ($(window).height() - $(this).outerHeight()) / 2;
|
154
|
+
|
155
|
+
if (wy < 0) wy = 0;
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
// ポップアップウインドウを表示する。
|
160
|
+
|
161
|
+
$this.css('top', wy).css('left', wx).fadeIn(100);
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
// 閉じるボタンを押したとき
|
166
|
+
|
167
|
+
$this.find('.ipop_close').click(function(){ $this.fadeOut(100);});
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
// タイトルバーをドラッグしたとき
|
172
|
+
|
173
|
+
$this.find('.ipop_title').mousedown(function(e) {
|
174
|
+
|
175
|
+
mx = e.pageX;
|
176
|
+
|
177
|
+
my = e.pageY;
|
178
|
+
|
179
|
+
$(document).mousemove(mouseMove).mouseup(mouseUp);
|
180
|
+
|
181
|
+
return false;
|
182
|
+
|
183
|
+
});
|
184
|
+
|
185
|
+
function mouseMove(e) {
|
186
|
+
|
187
|
+
wx += e.pageX - mx;
|
188
|
+
|
189
|
+
wy += e.pageY - my;
|
190
|
+
|
191
|
+
$this.css('top', wy).css('left', wx);
|
192
|
+
|
193
|
+
mx = e.pageX;
|
194
|
+
|
195
|
+
my = e.pageY;
|
196
|
+
|
197
|
+
return false;
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
function mouseUp() {
|
202
|
+
|
203
|
+
$(document).unbind('mousemove', mouseMove).unbind('mouseup', mouseUp);
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
})(jQuery);
|
210
|
+
|
211
|
+
</script>
|
130
212
|
|
131
213
|
</body>
|
132
214
|
|
133
|
-
|
134
|
-
|
135
215
|
</html>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<script>
|
140
|
-
|
141
|
-
(function($) {
|
142
|
-
|
143
|
-
$.fn.ipop = function() {
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
var $this = $(this);
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
var wx, wy; // ウインドウの左上座標
|
152
|
-
|
153
|
-
var mx, my; // マウスの座標
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
// ウインドウの座標を画面中央にする。
|
158
|
-
|
159
|
-
wx = $(document).scrollLeft() + ($(window).width() - $(this).outerWidth()) / 2;
|
160
|
-
|
161
|
-
if (wx < 0) wx = 0;
|
162
|
-
|
163
|
-
wy = $(document).scrollTop() + ($(window).height() - $(this).outerHeight()) / 2;
|
164
|
-
|
165
|
-
if (wy < 0) wy = 0;
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
// ポップアップウインドウを表示する。
|
170
|
-
|
171
|
-
$this.css('top', wy).css('left', wx).fadeIn(100);
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
// 閉じるボタンを押したとき
|
176
|
-
|
177
|
-
$this.find('.ipop_close').click(function(){ $this.fadeOut(100);});
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
// タイトルバーをドラッグしたとき
|
182
|
-
|
183
|
-
$this.find('.ipop_title').mousedown(function(e) {
|
184
|
-
|
185
|
-
mx = e.pageX;
|
186
|
-
|
187
|
-
my = e.pageY;
|
188
|
-
|
189
|
-
$(document).mousemove(mouseMove).mouseup(mouseUp);
|
190
|
-
|
191
|
-
return false;
|
192
|
-
|
193
|
-
});
|
194
|
-
|
195
|
-
function mouseMove(e) {
|
196
|
-
|
197
|
-
wx += e.pageX - mx;
|
198
|
-
|
199
|
-
wy += e.pageY - my;
|
200
|
-
|
201
|
-
$this.css('top', wy).css('left', wx);
|
202
|
-
|
203
|
-
mx = e.pageX;
|
204
|
-
|
205
|
-
my = e.pageY;
|
206
|
-
|
207
|
-
return false;
|
208
|
-
|
209
|
-
}
|
210
|
-
|
211
|
-
function mouseUp() {
|
212
|
-
|
213
|
-
$(document).unbind('mousemove', mouseMove).unbind('mouseup', mouseUp);
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
})(jQuery);
|
220
|
-
|
221
|
-
</script>
|