1

Bootstrap 有一个带有远程选项的模态方法。我想对 Jquery/Bootstrap 加载的内容执行一些操作。(例如,扫描特定类并即时替换内容)。

modal() 方法中是否有“加载”选项?

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

我现在通过使用 setTimeout() 函数来解决这个问题;但这不是一种优雅的方式。

4

1 回答 1

0

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
});
于 2013-10-04T13:52:29.417 回答