質問編集履歴
3
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,14 +6,14 @@
|
|
6
6
|
<iframe src="" class="autoHeight" frameborder="0" style="width: 100%"></iframe>
|
7
7
|
|
8
8
|
$(window).on("load",function(){
|
9
|
-
|
9
|
+
$('iframe.autoHeight').each(function(){
|
10
|
-
|
10
|
+
var D = $(this).get(0).contentWindow.document;
|
11
|
-
|
11
|
+
var innerHeight = Math.max(
|
12
|
-
|
12
|
+
D.body.scrollHeight, D.documentElement.scrollHeight,
|
13
|
-
|
13
|
+
D.body.offsetHeight, D.documentElement.offsetHeight,
|
14
|
-
|
14
|
+
D.body.clientHeight, D.documentElement.clientHeight
|
15
|
-
|
15
|
+
);
|
16
|
-
|
16
|
+
$(this).removeAttr("height").css('height', innerHeight + 'px');
|
17
|
-
|
17
|
+
});
|
18
|
-
|
18
|
+
});
|
19
19
|
```
|
2
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
これは何故なのでしょうか?
|
4
4
|
|
5
5
|
```
|
6
|
+
<iframe src="" class="autoHeight" frameborder="0" style="width: 100%"></iframe>
|
7
|
+
|
6
8
|
$(window).on("load",function(){
|
7
9
|
$('iframe.autoHeight').each(function(){
|
8
10
|
var D = $(this).get(0).contentWindow.document;
|
1
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
何も中身がないときはheight: 0;にしたいのですが、中身が無い時でも高さが150px出てしまいます。
|
3
3
|
これは何故なのでしょうか?
|
4
4
|
|
5
|
-
|
5
|
+
```
|
6
6
|
$(window).on("load",function(){
|
7
7
|
$('iframe.autoHeight').each(function(){
|
8
8
|
var D = $(this).get(0).contentWindow.document;
|
@@ -14,4 +14,4 @@
|
|
14
14
|
$(this).removeAttr("height").css('height', innerHeight + 'px');
|
15
15
|
});
|
16
16
|
});
|
17
|
-
|
17
|
+
```
|