質問編集履歴

1

画像とコードの追加

2018/03/15 11:21

投稿

mojao_0227
mojao_0227

スコア24

test CHANGED
@@ -1 +1 @@
1
- CSSのみでiframeの2重のスクロールバーを回避したい
1
+ CSSのみでiframeの2重のスクロールを回避したい
test CHANGED
@@ -2,13 +2,205 @@
2
2
 
3
3
  iframeを使い、ECサイトの構築を行っています。
4
4
 
5
- iframeを表示している部分は良いのですが、tableの領域スクロールが二重になり
5
+ iframe領域から、下にスクロールする際は問題ありませんが、
6
-
7
- カーソルの位置によっては上に戻るスクロールでiframe/table両方の領域が見えてしまいます。
6
+
8
-
9
- tableの領域からスクロールアップしていく時2重のスクロールバーを回避したいで
7
+ tableの領域に入るとスクロールが二重なり、途中で上にスクロールすると、添付画像の様に
8
+
10
-
9
+ iframe/table両方の領域が見えてしまい、どちらもスクロールできてしまいます。
10
+
11
+
12
+
11
-
13
+ tableの領域で上スクロールする時にiframeはスクロールさせず、
14
+
15
+ 可視範囲からtable領域が消えたらiframeをスクロールできれば良いと思っているのですが...
16
+
17
+
18
+
19
+ ![現状スクショ](61b03ce6d2c0ba26adb357526cbb24e0.jpeg)
20
+
21
+
22
+
23
+ cssのみ、もしくは子フレームのみのscriptを書くことで回避できる方法を探しています。
24
+
25
+ ご存知の方いらっしゃいましたらご教示頂けますと幸いです。
26
+
27
+
28
+
29
+
30
+
31
+ ```html
32
+
33
+ <body style="overflow: hidden">
34
+
35
+ <div id="pageBody">
36
+
37
+ <div id="body_wrapper">
38
+
39
+ <iframe id="body_template" scrolling="auto" src="/src/index.html" width="100%" height="100%" frameborder="0">
40
+
41
+      <html>
42
+
43
+      <head></head>
44
+
45
+ <body class="onProduct">
46
+
47
+ <main class="test_box" id="js-main">
48
+
49
+ <div class="product-hero_container">
50
+
51
+ <div class="product-hero_wrapper"></div>
52
+
53
+ </div>
54
+
55
+ <div class="productArticle">
56
+
57
+ <section class="st-Lead_container"></section>
58
+
59
+ <section class="product_lists">
60
+
61
+ <ul>
62
+
63
+ <li>
64
+
65
+ <div class="product-Block js-scroll-fade">
66
+
67
+ <div class="product_images"></div>
68
+
69
+ </div>
70
+
71
+ </li>
72
+
73
+ <li>
74
+
75
+ <div class="product-Block js-scroll-fade">
76
+
77
+ <div class="product_images"></div>
78
+
79
+ </div>
80
+
81
+ </li>
82
+
83
+ </ul>
84
+
85
+ </section>
86
+
87
+ <section class="section_base3"></section>
88
+
89
+ </div>
90
+
91
+ </main>
92
+
93
+ </body>
94
+
95
+ </html>
96
+
97
+ </iframe>
98
+
99
+
100
+
101
+ <table cellspacing="0" cellpadding="0" border="0" style="overflow:scroll">
102
+
103
+ <tbody>
104
+
105
+ <tr>
106
+
107
+ <td>
108
+
109
+ <table cellspacing="0" cellpadding="0" border="0">
110
+
111
+             <a href="image1"></a>
112
+
113
+ <a href="image2"></a>
114
+
115
+ <a href="image3"></a>
116
+
117
+           </table> 
118
+
119
+ </td>
120
+
121
+ <td>
122
+
123
+ <table cellspacing="2" cellpadding="0" border="0">
124
+
125
+ <tbody><tr><td>価格</td></tr></tbody>
126
+
127
+             <tbody><tr><td>名称</td></tr></tbody>
128
+
129
+ </table>
130
+
131
+ </td>
132
+
133
+ </tr>
134
+
135
+ </tbody>
136
+
137
+ </table>
138
+
139
+ </div>
140
+
141
+ </div>
142
+
143
+ </body>
144
+
145
+ ```
146
+
147
+ ```css
148
+
149
+ body {
150
+
151
+ padding: 0;
152
+
153
+ margin: 0;
154
+
155
+ }
156
+
157
+
158
+
159
+ .product-hero_container{
160
+
161
+ background-color: pink;
162
+
163
+ padding-bottom: 100vh;
164
+
165
+ }
166
+
167
+
168
+
169
+ .st-Lead_container {
170
+
171
+ background-color: aquamarine;
172
+
173
+ padding-bottom: 100vh;
174
+
175
+ }
176
+
177
+
178
+
179
+ .product_lists {
180
+
181
+ background-color: cornflowerblue;
182
+
183
+ padding-bottom: 100vh;
184
+
185
+ }
186
+
187
+ .section_base3 {
188
+
189
+ background-color: peachpuff;
190
+
191
+ padding-bottom: 100vh;
192
+
193
+ }
194
+
195
+
196
+
197
+ ```
198
+
199
+
200
+
201
+
202
+
203
+ 備考://
12
204
 
13
205
  下記3点を検討したのですが、いずれも不可でした。
14
206
 
@@ -17,81 +209,3 @@
17
209
  ・iframeのscrollingをnoにしてheightを調整していく -> さすがに現実的でない
18
210
 
19
211
  ・一番下までスクロールしたら、子フレームにoverflow:hiddenをつける -> スクロールアップで解除できない
20
-
21
-
22
-
23
- cssのみ、もしくは子フレームのみのscriptで回避できる方法を探しています。
24
-
25
- ご存知の方いらっしゃいましたらご教示頂けますと幸いです。
26
-
27
-
28
-
29
-
30
-
31
- ```html
32
-
33
- <body style="overflow: hidden">
34
-
35
- <div id="pageBody">
36
-
37
- <div id="body_wrapper">
38
-
39
- <iframe id="body_template" scrolling="auto" src="/src/index.html" width="100%" height="100%" frameborder="0">
40
-
41
-      <html>
42
-
43
-      <head></head>
44
-
45
- <body>
46
-
47
-       <section class="hero-images"></section>
48
-
49
- <section class="section_b"></section>
50
-
51
- <section class="section_c"></section>
52
-
53
- <script src="jquery-3.2.1.min.js"></script>
54
-
55
- <script src="lib.js"></script>
56
-
57
- </body>
58
-
59
- </html>
60
-
61
- </iframe>
62
-
63
-
64
-
65
- <table cellspacing="0" cellpadding="0" border="0" style="overflow:scroll">
66
-
67
- <tbody>
68
-
69
- <tr>
70
-
71
- <td>
72
-
73
- <table cellspacing="0" cellpadding="0" border="0">
74
-
75
-             <a href="image1"></a>
76
-
77
- <a href="image2"></a>
78
-
79
- <a href="image3"></a>
80
-
81
-           </table> 
82
-
83
- </td>
84
-
85
- </tr>
86
-
87
- </tbody>
88
-
89
- </table>
90
-
91
- </div>
92
-
93
- </div>
94
-
95
- </body>
96
-
97
- ```