How to preload iframe

后端 未结 2 948
[愿得一人]
[愿得一人] 2021-01-13 17:37
function toggle(){
    $(\"#tempc\").toggle(
        function () {
            $(\"#tempc\").animate({width: 255, height: 220}, 1000);
            $(\"#tempc\").html         


        
相关标签:
2条回答
  • 2021-01-13 18:01

    With JQuery, you don't need to use iframes. Take a look at the .load() function. http://api.jquery.com/load

    i.e.

    $('#tempc').load('src/stream.php?stream=1');
    

    To preload a page, just create a hidden div and show it when ready.

    var stream2 = $('<div>').load('src/stream.php?stream=2').hide();
    $('#tempc').html(stream2.html());
    
    0 讨论(0)
  • 2021-01-13 18:13

    Start by loading the iframe, hook into onLoad on the iframe (this might give you a headache in itself, but a little googling should show you how to make this work well cross browser) and run your animation from this event.

    0 讨论(0)
提交回复
热议问题