回答編集履歴

2

修正

2018/12/06 13:39

投稿

退会済みユーザー
test CHANGED
@@ -85,3 +85,133 @@
85
85
  }
86
86
 
87
87
  ```
88
+
89
+ ###追記
90
+
91
+ ```HTML
92
+
93
+ <!DOCTYPE html>
94
+
95
+ <html lang="ja">
96
+
97
+ <head>
98
+
99
+ <meta charset="utf-8">
100
+
101
+ <title>ページタイトル</title>
102
+
103
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.css">
104
+
105
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
106
+
107
+ <script src="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.min.js"></script>
108
+
109
+
110
+
111
+ <script>
112
+
113
+ $(document).ready(function(){
114
+
115
+ $('.slider').bxSlider();
116
+
117
+ });
118
+
119
+ </script>
120
+
121
+ <style>
122
+
123
+ html {
124
+
125
+ height: 100%;
126
+
127
+ }
128
+
129
+ body {
130
+
131
+ height: 100%;
132
+
133
+ }
134
+
135
+ img {
136
+
137
+ width: auto;
138
+
139
+ height: 100vh;
140
+
141
+ object-fit: cover;
142
+
143
+ }
144
+
145
+ /* パソコンで見たときは"pc"のclassがついた画像が表示される */
146
+
147
+ @media only screen and (min-width: 801px) {
148
+
149
+ .pc { display: block !important; }
150
+
151
+ .sp { display: none !important; }
152
+
153
+ }
154
+
155
+ /* スマートフォンで見たときは"sp"のclassがついた画像が表示される */
156
+
157
+ @media only screen and (max-width: 800px) {
158
+
159
+ .pc { display: none !important; }
160
+
161
+ .sp { display: block !important; }
162
+
163
+ }
164
+
165
+ </style>
166
+
167
+ </head>
168
+
169
+ <body>
170
+
171
+ <div class="pc">
172
+
173
+ <ul class="slider">
174
+
175
+ <!-- パソコン用の記述 -->
176
+
177
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=パソコン用" title="パソコン用画像"></li>
178
+
179
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=パソコン用" title="パソコン用画像"></li>
180
+
181
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=パソコン用" title="パソコン用画像"></li>
182
+
183
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=パソコン用" title="パソコン用画像"></li>
184
+
185
+ </ul>
186
+
187
+ </div>
188
+
189
+ <div class="sp">
190
+
191
+ <ul class="slider">
192
+
193
+ <!-- タブレット等用の記述 -->
194
+
195
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=スマホ・タブレット用" title="スマホ・タブレット用画像"></li>
196
+
197
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=スマホ・タブレット用" title="スマホ・タブレット用画像"></li>
198
+
199
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=スマホ・タブレット用" title="スマホ・タブレット用画像"></li>
200
+
201
+ <li><img src="http://placehold.jp/100/cccccc/ffffff/2500x500.png?text=スマホ・タブレット用" title="スマホ・タブレット用画像"></li>
202
+
203
+ </ul>
204
+
205
+ </div>
206
+
207
+
208
+
209
+
210
+
211
+ </body>
212
+
213
+ </html>
214
+
215
+ ```
216
+
217
+ 念のため[サンプル](http://yoshi0819.s1007.xrea.com/sample/00001/)を

1

誤差を修正

2018/12/06 13:39

投稿

退会済みユーザー
test CHANGED
@@ -68,13 +68,13 @@
68
68
 
69
69
  }
70
70
 
71
- /* パソコンで見たときは"pc"のclassがついた画像が表示される */
71
+ @media only screen and (min-width: 769px) {
72
72
 
73
73
  .pc { display: block !important; }
74
74
 
75
75
  .sp { display: none !important; }
76
76
 
77
- /* スマートフォンで見たときは"sp"のclassがついた画像が表示される */
77
+ }
78
78
 
79
79
  @media only screen and (max-width: 768px) {
80
80