Iframe löst keine resize-Ereignis

Nach 3 Tagen von Forschung und Versuch und Irrtum, ich bin nicht in der Lage, um die iframe noch Ihr Inhalt löst ein resize-Ereignis aus, so dass meine resize-Funktion aufgerufen wird. Wenn ich ...trigger("resize"); manuell auslösen ein resize-Ereignis aus, meine resize-Funktion wird aufgerufen und funktioniert. Die Seite, die geladen wird, in den iframe auf der gleichen domain (http://localhost:81/curlExample/) als die Seite mit dem iframe. Schließlich, die Seite in dem iframe wird eine Lieferung durch die php-curl-Methode, aber ich möchte, um es arbeiten erste.

******* Aktualisiert********
Wie bekomme ich das resize-Ereignis ausgelöst, wenn ich die Größe des browser-Fensters, die bewirkt, dass der iframe auf seine Größe anpassen?


Danke für Eure Hilfe!

Seite mit dem iframe

HTML:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
   
    function setResize()
    {
        window.alert("Hello");
      
        var iframeRef = document.getElementById('displayframe');
        $(iframeRef).on("resize", function(){
            var xExp = 0;
            window.alert("Resize event fired.");
            
        });
    }
  
    $('#displayframe').load(function()
    {
        alert("Hello from iFrame.  Load event fired.");
        var myStallTime = setTimeout(setResize, 3000);

    });

});
</script>
</head>
<body>

<p id="myP">Hello</p>

<iframe id="displayframe" src="http://localhost:81/curlExample/HelloIframe.xhtml" style="height:250px; width:100%;">
  <p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>

Seite innerhalb des iframe (HelloIframe.xhtml)

HTML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>TODO supply a title</title>
    </head>
    <body>
        <div id="myContent" style="width:100%; height:200px;">
            <h1>TODO write content</h1>
            <h2>Extremity sweetness difficult behaviour he of</h2>

            <p>Agreed joy vanity regret met may ladies oppose who. Mile fail as left as hard eyes. Meet made call in mean four year it to. Prospect so branched wondered sensible of up. For gay consisted resolving pronounce sportsman saw discovery not. Northward or household as conveying we earnestly believing. No in up contrasted discretion inhabiting excellence. Entreaties we collecting unpleasant at everything conviction.</p>

            <p>Yet remarkably appearance get him his projection. Diverted endeavor bed peculiar men the not desirous. Acuteness abilities ask can offending furnished fulfilled sex. Warrant fifteen exposed ye at mistake. Blush since so in noisy still built up an again. As young ye hopes no he place means. Partiality diminution gay yet entreaties admiration. In mr it he mention perhaps attempt pointed suppose. Unknown ye chamber of warrant of norland arrived.</p>

        </div>
    </body>
</html>

  • Ähm, warum sind Sie nicht zu hören, um die Größe auf das aktuelle Fenster?
  • Nicht genau sicher, was oder was nicht funktioniert oder was die Ziele sind, oder was erwarten Sie von diesem resize
InformationsquelleAutor ermSO | 2015-01-08
Schreibe einen Kommentar