简体   繁体   English

使用远程内容时,是否存在引导程序模式加载(或类似)功能?

[英]Is there a bootstrap modal onloaded (or similar) function when using remote content?

Bootstrap has a modal-method with a remote option. Bootstrap具有带远程选项的模态方法。 I want to perform some actions on the content that has been loaded by Jquery/Bootstrap. 我想对Jquery / Bootstrap加载的内容执行一些操作。 (eg, scan for specific classes and replace content on the fly). (例如,扫描特定的类别并即时替换内容)。

Is there an 'onloaded' option in the modal() method? modal()方法中是否有一个“ onloaded”选项?

$('#someplaceholder'.modal({
    remote: "data/whatever/123",
    onloaded: function() {
    // perform some substitution,...
        },
});

I solve this now by using a setTimeout() function; 我现在通过使用setTimeout()函数解决此问题; but this is not an elegant way. 但这不是一个优雅的方法。

Bootstrap modal 'loaded' event on remote fragment 远程片段上的引导模式“已加载”事件

There is no loaded event and it doesn't look like bootstrap is providing a fix for this. 没有加载的事件,并且引导程序似乎无法为此提供修复。 You can do the following. 您可以执行以下操作。

$('#someplaceholder').modal().find('.modal-body').load("data/whatever/123", function (data) {
    //do stuff with returned data here
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM