teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

ソースに誤りがあった為再編集いたしました。

2019/03/01 01:50

投稿

canazawa__
canazawa__

スコア13

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,10 @@
1
+ タブをマウスオーバーで切り替えるナビゲーションを作成したいのですが、
2
+ タブの中身( <div class="hide"></div>の中)にaタグを追加し、
3
+ そのaタグをマウスオーバーするとタブの中身(<div class="hide"></div>)がdisplay:noneになってしまい非表示になってしまいます。
4
+ aタグをマウスオーバーしても表示されるようにしたいのですが可能でしょうか?
5
+ よろしくお願いいたします。
6
+
1
- <html>
7
+ ```<html>
2
8
  <head>
3
9
  <meta charset="utf-8">
4
10
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
@@ -68,4 +74,5 @@
68
74
  </div>
69
75
  </div>
70
76
  </body>
71
- </html>
77
+ </html>
78
+ ```

2

ソースに誤りがあった為編集いたしました。

2019/03/01 01:50

投稿

canazawa__
canazawa__

スコア13

title CHANGED
File without changes
body CHANGED
@@ -1,18 +1,10 @@
1
- マウスオーバーで表示を切り変えるタブメニューを作成したいのですが、
2
- 下記のタブの中身(<div class="hide"></div>の中)にaタグのリンクを付け、
3
- そのリンクをマウスオーバーするとタブの中身がdisplay:noneになってしまい表示されません。
4
- 回避する方法はありますでしょうか?
5
-
6
-
7
-
8
- ```<!doctype html>
9
1
  <html>
10
2
  <head>
11
3
  <meta charset="utf-8">
12
4
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
13
5
  <title>無題ドキュメント</title>
14
6
  <script>
15
- $(function() {
7
+ $(function() {
16
8
  $('.tab li').hover(function() {
17
9
  var tabnum = $('.tab li').index(this);
18
10
  $('.content div').css('display','none');
@@ -21,43 +13,43 @@
21
13
  $(this).addClass('select')
22
14
  });
23
15
 
24
- $('.hide').mouseout(function() {
16
+ $('.hide').mouseout(function() {
25
- this.style.display = "block";
17
+ this.style.display = "none";
26
-
18
+
27
19
  });
28
20
 
29
-
30
-
21
+
22
+
31
- });
23
+ });
32
-
24
+
33
- </script>
25
+ </script>
34
26
  <style>
35
27
  .tabmenu {
36
- width: 60%;
28
+ width: 60%;
37
29
  }
38
30
  .tab {
39
- overflow: hidden;
31
+ overflow: hidden;
40
- margin: 0;
32
+ margin: 0;
41
- padding: 0;
33
+ padding: 0;
42
- list-style: none;
34
+ list-style: none;
43
35
  }
44
36
  .tab li {
45
- cursor: pointer;
37
+ cursor: pointer;
46
- display: inline-block;
38
+ display: inline-block;
47
- width: auto;
39
+ width: auto;
48
- padding: .3em;
40
+ padding: .3em;
49
- font-weight: bold;
41
+ font-weight: bold;
50
42
  }
51
43
  .tab li.select {
52
- border-bottom: solid 4px #fdbb30;
44
+ border-bottom: solid 4px #fdbb30;
53
45
  }
54
46
  .content div {
55
- height: auto;
47
+ height: auto;
56
- padding: .6em;
48
+ padding: .6em;
57
- border: solid 1px #ccc;
49
+ border: solid 1px #ccc;
58
50
  }
59
51
  .hide {
60
- display: none;
52
+ display: none;
61
53
  }
62
54
  </style>
63
55
  </head>
@@ -76,5 +68,4 @@
76
68
  </div>
77
69
  </div>
78
70
  </body>
79
- </html>
71
+ </html>
80
- ```

1

失礼いたしました。<code>の中に記載いたしました。よろしくお願いいたします。

2019/03/01 01:46

投稿

canazawa__
canazawa__

スコア13

title CHANGED
File without changes
body CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- <!doctype html>
8
+ ```<!doctype html>
9
9
  <html>
10
10
  <head>
11
11
  <meta charset="utf-8">
@@ -76,4 +76,5 @@
76
76
  </div>
77
77
  </div>
78
78
  </body>
79
- </html>
79
+ </html>
80
+ ```