質問編集履歴
4
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -71,4 +71,62 @@
|
|
71
71
|
</body>
|
72
72
|
</html>
|
73
73
|
|
74
|
+
```
|
75
|
+
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
追記2
|
80
|
+
|
81
|
+
タイムマージンを使った方法
|
82
|
+
```htnl
|
83
|
+
<!DOCTYPE HTML>
|
84
|
+
<html>
|
85
|
+
<head>
|
86
|
+
<meta charset="UTF-8"/>
|
87
|
+
<meta http-equiv="content-language" content="ja"/>
|
88
|
+
<title>TEST</title>
|
89
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
90
|
+
<style>
|
91
|
+
#box{
|
92
|
+
position: relative;
|
93
|
+
background: aqua;
|
94
|
+
top:20px;
|
95
|
+
width: 300px;
|
96
|
+
border: solid blue;
|
97
|
+
}
|
98
|
+
</style>
|
99
|
+
</head>
|
100
|
+
<body>
|
101
|
+
<input type="text" id="textbox">
|
102
|
+
<div id="box" style="display:none">
|
103
|
+
<a href="">リンク</a><br>
|
104
|
+
<button type="button">ボタン</button>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<script>
|
108
|
+
$(function(){
|
109
|
+
|
110
|
+
// ボックスを表示する
|
111
|
+
$('#textbox').on('focus',function(){
|
112
|
+
$('#box').show();
|
113
|
+
});
|
114
|
+
|
115
|
+
// ボックスを非表示にする
|
116
|
+
var timerId
|
117
|
+
$('#textbox').on('focusout',function(){
|
118
|
+
timerId = setTimeout(function(){
|
119
|
+
$('#box').hide();
|
120
|
+
},1000);
|
121
|
+
});
|
122
|
+
|
123
|
+
// ボックス内をクリックした際ボックスを非表示にしない
|
124
|
+
$('#box').on('click',function(){
|
125
|
+
clearTimeout(timerId);
|
126
|
+
});
|
127
|
+
});
|
128
|
+
</script>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|
74
132
|
```
|
3
依頼対応
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,4 +18,57 @@
|
|
18
18
|
ボックス外をクリックした際は、ボックスを非表示にしたいのですが、
|
19
19
|
ボックス内をクリックした際はボックスを表示したままにしたいのです。
|
20
20
|
|
21
|
-
focusoutには別にこだわっていないので、何かいい方法や別のやり方を知っていらっしゃる方がいれば教えていただきたいです。
|
21
|
+
focusoutには別にこだわっていないので、何かいい方法や別のやり方を知っていらっしゃる方がいれば教えていただきたいです。
|
22
|
+
|
23
|
+
|
24
|
+
---
|
25
|
+
|
26
|
+
追記
|
27
|
+
|
28
|
+
画面イメージ
|
29
|
+
|
30
|
+

|
31
|
+
|
32
|
+
コードは以下です。
|
33
|
+
```html
|
34
|
+
<!DOCTYPE HTML>
|
35
|
+
<html>
|
36
|
+
<head>
|
37
|
+
<meta charset="UTF-8"/>
|
38
|
+
<meta http-equiv="content-language" content="ja"/>
|
39
|
+
<title>TEST</title>
|
40
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
41
|
+
<style>
|
42
|
+
#box{
|
43
|
+
position: relative;
|
44
|
+
background: aqua;
|
45
|
+
top:20px;
|
46
|
+
width: 300px;
|
47
|
+
border: solid blue;
|
48
|
+
}
|
49
|
+
</style>
|
50
|
+
</head>
|
51
|
+
<body>
|
52
|
+
<input type="text" id="textbox">
|
53
|
+
<div id="box" style="display:none">
|
54
|
+
<a href="a.shtml">リンク</a><br>
|
55
|
+
<button type="button">ボタン</button>
|
56
|
+
</div>
|
57
|
+
<script>
|
58
|
+
$(function(){
|
59
|
+
|
60
|
+
// ボックスを表示する
|
61
|
+
$('#textbox').on('focus',function(){
|
62
|
+
$('#box').show();
|
63
|
+
});
|
64
|
+
|
65
|
+
// ボックスを非表示にする
|
66
|
+
$('#textbox').on('focusout',function(){
|
67
|
+
$('#box').hide();
|
68
|
+
});
|
69
|
+
});
|
70
|
+
</script>
|
71
|
+
</body>
|
72
|
+
</html>
|
73
|
+
|
74
|
+
```
|
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
現在上記
|
1
|
+
現在上記タグの技術を使って、アプリ開発を行っています。
|
2
2
|
|
3
3
|
仕様は以下です。
|
4
4
|
|
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
現在上記の
|
1
|
+
現在上記のタグを使って、アプリ開発を行っています。
|
2
2
|
|
3
3
|
仕様は以下です。
|
4
4
|
|