回答編集履歴
2
読みやすく修正。
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
これでどうでしょう。
|
1
|
+
~~これでどうでしょう。~~
|
2
2
|
```js
|
3
3
|
$( this ).height( 0 );
|
4
4
|
$( this ).css( { height: this.contentWindow.document.documentElement.scrollHeight + "px!important" } );
|
1
ミスがあったため修正。
answer
CHANGED
@@ -2,4 +2,17 @@
|
|
2
2
|
```js
|
3
3
|
$( this ).height( 0 );
|
4
4
|
$( this ).css( { height: this.contentWindow.document.documentElement.scrollHeight + "px!important" } );
|
5
|
-
```
|
5
|
+
```
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
**追記:**
|
10
|
+
|
11
|
+
```js
|
12
|
+
$( this ).height( 0 );
|
13
|
+
var imp = $( this ).attr( "style" );
|
14
|
+
$( this ).css( { 'cssText': imp + 'height: ' + this.contentWindow.document.documentElement.scrollHeight + 'px !important;' } );
|
15
|
+
```
|
16
|
+
|
17
|
+
【jQueryでCSSの!important指定を行う - Qiita】
|
18
|
+
[https://qiita.com/shouchida/items/796f80bfe8bde31f1f79](https://qiita.com/shouchida/items/796f80bfe8bde31f1f79)
|