2017-09-20 5 views
0

埋め込みiframeを含むすべてがロードされるまで表示するには、ロード.gifを表示します。しかし、すべてiframeから離れてロードされると現在、ロードgifは消えます。 iframeもロードされるまで、どうすればそれを待つことができますか?iFrameがロードされるのを待たずにgifをロードしていますか?

<script> 
    $(window).ready(function() { 
    $('#loadinga').hide(); 
    }); 
</script> 

おかげ

+0

てみてください、あなたのiframeのIDがiframeId

であると仮定します。現在、これを使用して

').load(()=> ..) ' – Fabricator

答えて

0
<iframe name="xyz"></iframe> 

<script> 
    var expectedLoadCount = 2; 

    function checkEverythingLoaded() { 
    expectedLoadCount--; 
    if (expectedLoadCount > 0) return 
    $('#loadinga').hide(); 
    } 

    $("#xyz").on("load", checkEverythingLoaded); 
    $(window).ready(checkEverythingLoaded); 
</script> 
0

は `$( 'IFRAMEを試してみてくださいthis-

<iframe id="iframeId" src="..."></iframe> 

<script> 
document.getElementById('iframeId').onload = function() { 
$('#loadinga').hide(); 

    alert('iframe is loaded'); 
}; 
</script> 
関連する問題