Skip to content

sable-virt/iframe-resizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iframe-resizer

クロスドメインでもiframeの中身にiframeの高さを揃えるライブラリ

条件

親子ともにスクリプトを埋め込める環境であること。他人のサイトの高さは取ることができません。

使い方

親側

FrameReceiver.jsを読み込みます。

<script src="./FrameReceiver.js"></script>

リサイズさせたいiframeには必ずIDとクラスをつけます。

<iframe src="./frames/content.html" id="content" class="iframe-resize"></iframe>

子側

FrameSender.jsを読み込みます。

<script src="./FrameSender.js"></script>

サイズ変更

初回及びwindowがリサイズされたときに高さが更新されます。

Public Functions

FrameReceiver.send()

親側からiframeの高さを更新します。任意のタイミングで高さの再取得が可能です。

FrameSender.send();

子側からiframeの高さを更新します。任意のタイミングで高さの再取得が可能です。

License

MIT License

About

クロスドメインでもiframeの中身の高さに合わせてiframeの高さを揃えるライブラリ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published