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

質問編集履歴

3

訂正

2018/06/05 05:40

投稿

ysfree14
ysfree14

スコア19

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
- $('iframe.autoHeight').each(function(){
9
+     $('iframe.autoHeight').each(function(){
10
- var D = $(this).get(0).contentWindow.document;
10
+         var D = $(this).get(0).contentWindow.document;
11
- var innerHeight = Math.max(
11
+         var innerHeight = Math.max(
12
- D.body.scrollHeight, D.documentElement.scrollHeight,
12
+         D.body.scrollHeight, D.documentElement.scrollHeight,
13
- D.body.offsetHeight, D.documentElement.offsetHeight,
13
+         D.body.offsetHeight, D.documentElement.offsetHeight,
14
- D.body.clientHeight, D.documentElement.clientHeight
14
+         D.body.clientHeight, D.documentElement.clientHeight
15
- );
15
+         );
16
- $(this).removeAttr("height").css('height', innerHeight + 'px');
16
+         $(this).removeAttr("height").css('height', innerHeight + 'px');
17
- });
17
+     });
18
- });
18
+ });
19
19
  ```

2

訂正

2018/06/05 05:39

投稿

ysfree14
ysfree14

スコア19

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

訂正

2018/06/05 05:38

投稿

ysfree14
ysfree14

スコア19

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
+ ```