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

質問編集履歴

1

コードの追記

2019/10/17 08:02

投稿

us_k
us_k

スコア6

title CHANGED
File without changes
body CHANGED
@@ -15,6 +15,19 @@
15
15
  ###コード
16
16
  .sliderのサイズの可変を試みています。videoに関しては問題なくサイズが変化します。
17
17
  ```html
18
+ <!DOCTYPE html>
19
+ <html lang="ja">
20
+ <head>
21
+ <meta charset="UTF-8">
22
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
23
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
24
+ <title>Inn the Park</title>
25
+ <link rel="stylesheet" href="/style2.css">
26
+ <link rel="stylesheet" href="/slick/slick.css">
27
+ <link rel="stylesheet" href="/slick/slick-theme.css">
28
+ </head>
29
+ <body>
30
+
18
31
  <div class="content-wrapper">
19
32
  <div class="slider">
20
33
  <div class="image">
@@ -30,6 +43,12 @@
30
43
  <video src="/img/ScreenRecording.mov"></video>
31
44
  </div>
32
45
  </div>
46
+
47
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
48
+ <script src="/slick/slick.js"></script>
49
+ <script src="/js/script.js"></script>
50
+ </body>
51
+ </html>
33
52
  ```
34
53
 
35
54
  ```css
@@ -48,6 +67,101 @@
48
67
  height: 100%;
49
68
  width: 100%;
50
69
  }
70
+
71
+ /*以下補足*/
72
+
73
+ * {
74
+ padding: 0;
75
+ margin: 0;
76
+ }
77
+
78
+ body {
79
+ width: 100%;
80
+ height: 100%;
81
+ overflow-x: hidden;
82
+ background-color: #f7f7f7;
83
+ }
84
+
85
+ html {
86
+ width: 100%;
87
+ height: 100%;
88
+ }
89
+
90
+ .video-wrapper {
91
+ width: 40%;
92
+ height: auto;
93
+ position: relative;
94
+ display: inline-block;
95
+ }
96
+
97
+ .video-wrapper:hover {
98
+ cursor: none;
99
+ }
100
+
101
+ .video-wrapper::before {
102
+ content: "";
103
+ display: block;
104
+ height: auto;
105
+ padding-top: calc(803 / 1440 *100%);
106
+ }
107
+
108
+ .video-wrapper #video-banner {
109
+ position: absolute;
110
+ top: 10px;
111
+ left: 10px;
112
+ background-color: rgba(0, 0, 0, 0.5);
113
+ color: white;
114
+ padding: 5px 20px;
115
+ border: 1px solid rgba(255, 255, 255, 0.5);
116
+ border-radius: 30px;
117
+ }
118
+
119
+ .video-wrapper video {
120
+ position: absolute;
121
+ top: 0;
122
+ left: 0;
123
+ height: auto;
124
+ width: 100%;
125
+ z-index: -100;
126
+ }
127
+
128
+ .content-wrapper {
129
+ display: -webkit-box;
130
+ display: -ms-flexbox;
131
+ display: flex;
132
+ -webkit-box-pack: center;
133
+ -ms-flex-pack: center;
134
+ justify-content: center;
135
+ -webkit-box-align: center;
136
+ -ms-flex-align: center;
137
+ align-items: center;
138
+ -ms-flex-pack: distribute;
139
+ justify-content: space-around;
140
+ height: 100%;
141
+ }
51
142
  ```
52
143
 
144
+ ```js
145
+ $(function(){
146
+
147
+ var $video = $('.video-wrapper');
53
- 該当すると思われる箇所のコードを記載しました。他の箇所のコードの影響が考えられる場合は追記いたします。
148
+ $video.on('mouseenter', function(){
149
+ $('video').get(0).play();
150
+ $('#video-banner').css('display', 'none');
151
+ });
152
+ $video.on('mouseout', function(){
153
+ $('video').get(0).pause();
154
+ $('#video-banner').css('display', 'block');
155
+ });
156
+
157
+ $(".slider").slick({
158
+ dots: false,
159
+ vertical: false,
160
+ slidesToShow: 1,
161
+ slidesToScroll: 1,
162
+ });
163
+
164
+ });
165
+ ```
166
+
167
+ 状態が再現できるコードを追記いたしました。