質問編集履歴
3
質問内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
どこで不具合が発生しているのでしょうか…?
|
24
24
|
|
25
25
|
```html
|
26
|
-
<nav
|
26
|
+
<nav>
|
27
27
|
<div class="scroll-wrapper">
|
28
28
|
<div class="scroll">
|
29
29
|
<ul class="scroll-content">
|
@@ -41,11 +41,6 @@
|
|
41
41
|
```
|
42
42
|
|
43
43
|
```css
|
44
|
-
nav {
|
45
|
-
text-align: center;
|
46
|
-
z-index: 997;
|
47
|
-
transition: 0.5s ease;
|
48
|
-
}
|
49
44
|
.scroll-wrapper {
|
50
45
|
position: relative;
|
51
46
|
}
|
@@ -62,83 +57,10 @@
|
|
62
57
|
list-style-type: none;
|
63
58
|
display: inline-block;
|
64
59
|
}
|
65
|
-
/* ボタンデザイン */
|
60
|
+
/* ボタンデザインは割愛 */
|
66
|
-
.leftbutton,.rightbutton {
|
67
|
-
font-size: 18px;
|
68
|
-
width: 18px;
|
69
|
-
height: 18px;
|
70
|
-
line-height: 18px;
|
71
|
-
position: absolute;
|
72
|
-
background-color: #000;
|
73
|
-
opacity: .8;
|
74
|
-
color: #fff;
|
75
|
-
padding: 10px;
|
76
|
-
text-align: center;
|
77
|
-
border-radius: 50%;
|
78
|
-
border: 1px solid #fff;
|
79
|
-
top: 50%;
|
80
|
-
-webkit-transform: translate(0, -50%); /* Safari用 */
|
81
|
-
transform: translate(0, -50%);
|
82
|
-
}
|
83
|
-
.leftbutton:hover,.rightbutton:hover {
|
84
|
-
color: #fff;
|
85
|
-
}
|
86
|
-
.leftbutton {
|
87
|
-
display: none;
|
88
|
-
left: 0;
|
89
|
-
box-shadow: 1px 1px 1px #888;
|
90
|
-
}
|
91
|
-
.rightbutton {
|
92
|
-
right: 0;
|
93
|
-
box-shadow: -1px 1px 1px #888;
|
94
|
-
}
|
95
61
|
```
|
96
62
|
|
97
|
-
※jQuey
|
63
|
+
※jQueyも割愛
|
98
|
-
```javascript
|
99
|
-
$(function() {
|
100
|
-
var rightButton = $('.rightbutton'),
|
101
|
-
leftButton = $('.leftbutton'),
|
102
|
-
scroll = $('.scroll'),
|
103
|
-
scrollContent = $('.scroll-content'),
|
104
|
-
scrollWrapper = $('.scroll-wrapper');
|
105
|
-
if (scrollContent.width() < scroll.width()) {
|
106
|
-
rightButton.remove();
|
107
|
-
leftButton.remove();
|
108
|
-
} else {
|
109
|
-
}
|
110
|
-
//右へ
|
111
|
-
rightButton.click(function () {
|
112
|
-
scroll.animate({
|
113
|
-
scrollLeft: scroll.scrollLeft() + scroll.width()
|
114
|
-
}, 300);
|
115
|
-
return false;
|
116
|
-
});
|
117
|
-
//左へスクロールで表示
|
118
|
-
scroll.scroll(function () {
|
119
|
-
if($(this).scrollLeft() < scrollContent.width() - scroll.width()) {
|
120
|
-
rightButton.fadeIn();
|
121
|
-
} else {
|
122
|
-
rightButton.fadeOut();
|
123
|
-
}
|
124
|
-
});
|
125
|
-
//左へ
|
126
|
-
leftButton.click(function () {
|
127
|
-
scroll.animate({
|
128
|
-
scrollLeft: scroll.scrollLeft() - scroll.width()
|
129
|
-
}, 300);
|
130
|
-
return false;
|
131
|
-
});
|
132
|
-
//右へスクロールで表示
|
133
|
-
scroll.scroll(function () {
|
134
|
-
if($(this).scrollLeft() > 0) {
|
135
|
-
leftButton.fadeIn();
|
136
|
-
} else {
|
137
|
-
leftButton.fadeOut();
|
138
|
-
}
|
139
|
-
});
|
140
|
-
});
|
141
|
-
```
|
142
64
|
|
143
65
|
### 実現したいこと
|
144
66
|
|
2
質問内容を具体的になるように更新しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,16 +18,18 @@
|
|
18
18
|
|
19
19
|
### 実装しているコード
|
20
20
|
|
21
|
+
~~必要なコードだけ記述します。~~
|
22
|
+
ID、クラス名、カラー変更のCSSなどを除き、ほぼすべてのコードを記述しました。
|
21
|
-
|
23
|
+
どこで不具合が発生しているのでしょうか…?
|
22
24
|
|
23
25
|
```html
|
24
|
-
<nav>
|
26
|
+
<nav itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
|
25
27
|
<div class="scroll-wrapper">
|
26
28
|
<div class="scroll">
|
27
29
|
<ul class="scroll-content">
|
28
|
-
<li>メニュー1</li>
|
30
|
+
<li><a>メニュー1</a></li>
|
29
|
-
<li>メニュー2</li>
|
31
|
+
<li><a>メニュー2</a></li>
|
30
|
-
<li>メニュー3</li>
|
32
|
+
<li><a>メニュー3</a></li>
|
31
33
|
</ul>
|
32
34
|
</div>
|
33
35
|
<!-- 左のボタン -->
|
@@ -39,6 +41,11 @@
|
|
39
41
|
```
|
40
42
|
|
41
43
|
```css
|
44
|
+
nav {
|
45
|
+
text-align: center;
|
46
|
+
z-index: 997;
|
47
|
+
transition: 0.5s ease;
|
48
|
+
}
|
42
49
|
.scroll-wrapper {
|
43
50
|
position: relative;
|
44
51
|
}
|
@@ -51,10 +58,87 @@
|
|
51
58
|
display: inline-block;
|
52
59
|
white-space: nowrap;
|
53
60
|
}
|
61
|
+
nav li {
|
62
|
+
list-style-type: none;
|
63
|
+
display: inline-block;
|
64
|
+
}
|
54
|
-
/* ボタンデザイン
|
65
|
+
/* ボタンデザイン */
|
66
|
+
.leftbutton,.rightbutton {
|
67
|
+
font-size: 18px;
|
68
|
+
width: 18px;
|
69
|
+
height: 18px;
|
70
|
+
line-height: 18px;
|
71
|
+
position: absolute;
|
72
|
+
background-color: #000;
|
73
|
+
opacity: .8;
|
74
|
+
color: #fff;
|
75
|
+
padding: 10px;
|
76
|
+
text-align: center;
|
77
|
+
border-radius: 50%;
|
78
|
+
border: 1px solid #fff;
|
79
|
+
top: 50%;
|
80
|
+
-webkit-transform: translate(0, -50%); /* Safari用 */
|
81
|
+
transform: translate(0, -50%);
|
82
|
+
}
|
83
|
+
.leftbutton:hover,.rightbutton:hover {
|
84
|
+
color: #fff;
|
85
|
+
}
|
86
|
+
.leftbutton {
|
87
|
+
display: none;
|
88
|
+
left: 0;
|
89
|
+
box-shadow: 1px 1px 1px #888;
|
90
|
+
}
|
91
|
+
.rightbutton {
|
92
|
+
right: 0;
|
93
|
+
box-shadow: -1px 1px 1px #888;
|
94
|
+
}
|
55
95
|
```
|
56
96
|
|
97
|
+
※jQuey
|
98
|
+
```javascript
|
99
|
+
$(function() {
|
100
|
+
var rightButton = $('.rightbutton'),
|
101
|
+
leftButton = $('.leftbutton'),
|
102
|
+
scroll = $('.scroll'),
|
103
|
+
scrollContent = $('.scroll-content'),
|
104
|
+
scrollWrapper = $('.scroll-wrapper');
|
57
|
-
|
105
|
+
if (scrollContent.width() < scroll.width()) {
|
106
|
+
rightButton.remove();
|
107
|
+
leftButton.remove();
|
108
|
+
} else {
|
109
|
+
}
|
110
|
+
//右へ
|
111
|
+
rightButton.click(function () {
|
112
|
+
scroll.animate({
|
113
|
+
scrollLeft: scroll.scrollLeft() + scroll.width()
|
114
|
+
}, 300);
|
115
|
+
return false;
|
116
|
+
});
|
117
|
+
//左へスクロールで表示
|
118
|
+
scroll.scroll(function () {
|
119
|
+
if($(this).scrollLeft() < scrollContent.width() - scroll.width()) {
|
120
|
+
rightButton.fadeIn();
|
121
|
+
} else {
|
122
|
+
rightButton.fadeOut();
|
123
|
+
}
|
124
|
+
});
|
125
|
+
//左へ
|
126
|
+
leftButton.click(function () {
|
127
|
+
scroll.animate({
|
128
|
+
scrollLeft: scroll.scrollLeft() - scroll.width()
|
129
|
+
}, 300);
|
130
|
+
return false;
|
131
|
+
});
|
132
|
+
//右へスクロールで表示
|
133
|
+
scroll.scroll(function () {
|
134
|
+
if($(this).scrollLeft() > 0) {
|
135
|
+
leftButton.fadeIn();
|
136
|
+
} else {
|
137
|
+
leftButton.fadeOut();
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
```
|
58
142
|
|
59
143
|
### 実現したいこと
|
60
144
|
|
1
質問内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -58,5 +58,5 @@
|
|
58
58
|
|
59
59
|
### 実現したいこと
|
60
60
|
|
61
|
-
ブラウザ間・デバイス間で同じ表示にしたいのですが、どうすればよいでしょうか?
|
61
|
+
異なるブラウザ間・デバイス間で同じ表示にしたいのですが、どうすればよいでしょうか?
|
62
62
|
ベンダープレフィックス的なものを付ける必要はありますか?
|