“jQuery quand iframe est chargé” Réponses codées

jQuery vérifie si iframe est chargé

$('#myIframe').on('load', function(){
    //your code (will be called once iframe is done loading)
});
SamuraiR4cc00n

jQuery quand iframe est chargé

<script>
function checkIframeLoaded() {
    // Get a handle to the iframe element
    var iframe = document.getElementById('i_frame');
    var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

    // Check if loading is complete
    if (  iframeDoc.readyState  == 'complete' ) {
        //iframe.contentWindow.alert("Hello");
        iframe.contentWindow.onload = function(){
            alert("I am loaded");
        };
        // The loading is complete, call the function we want executed once the iframe is loaded
        afterLoading();
        return;
    } 

    // If we are here, it is not loaded. Set things up so we check   the status again in 100 milliseconds
    window.setTimeout(checkIframeLoaded, 100);
}

function afterLoading(){
    alert("I am here");
}
</script>

<body onload="checkIframeLoaded();"> 
CertainBadProgrammer

Réponses similaires à “jQuery quand iframe est chargé”

Questions similaires à “jQuery quand iframe est chargé”

Plus de réponses similaires à “jQuery quand iframe est chargé” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code