通过远程URL引导模式加载内容,等待模式完全加载内容,直到显示

问题描述:

我可以通过远程url将内容加载到引导模式中,但是问题是模式窗口打开了,但是没有加载内容.

i'm able to load content via a remote url into a bootstrap modal, but the problem is the modal window opens up, but the content is not loaded.

一旦加载了内容,模态的主体就会更新,并且高度会扩展以适合模态的内容.

Once the content is loaded the body of the modal is updated and the height expands to fit the content of the modal.

但是,我只想在内容完全加载后才显示模态,并可能在模态加载时显示动画gif.

However, i'd like to only display the modal once the content is fully loaded, and maybe display an animated gif while the modal is loading.

我看了看文档,但是一旦加载了模态,我没有看到关于回调的任何信息.我希望可以保留模式,直到触发回调并显示它为止. 我该怎么办?

I've looked at the docs, but i didn't see anything there about maybe a callback once the modal is loaded. I was hoping to maybe keep the modal hidden until the callback was fired and show it. how can i do this?

我感谢上面的评论.我使用以下JavaScript存储了锚标签的远程URL,这些锚标签使用数据属性('data-href')和锚类名称为'popup-links'来触发弹出窗口.

I got it thanks to the above comments. I stored the remote urls for the anchor tags that trigger a popup using a data attribute ('data-href') with the anchors class name as 'popup-links' using the following javascript:

$jq191('.popup-links').on( 'click', function( e ){
    var remote= $jq191( this ).data( 'href' );
    $jq191('.modal-body').load( remote, function( e ){
        $jq191( '#myModal' ).modal( 'show' );
    });
});