load iframe in bootstrap modal

后端 未结 6 1643
青春惊慌失措
青春惊慌失措 2020-12-14 22:00

I want to load an iframe into a bootstrap modal and show a loader before the iframe is loaded. I am using a simple jquery click function, but it is not working. I do not und

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 22:43

    It seems that your

    $(".modal").on('shown.bs.modal')   // One way Or
    

    You can do this in a slight different way, like this

    $('.btn').click(function(){
        // Send the src on click of button to the iframe. Which will make it load.
        $(".openifrmahere").find('iframe').attr("src","http://www.hf-dev.info");
        $('.modal').modal({show:true});
        // Hide the loading message
        $(".openifrmahere").find('iframe').load(function() {
            $('.loading').hide();
        });
    })
    

提交回复
热议问题