我遠程加載的內容是這樣的:如何在加載遠程內容之前延遲加載Boostrap模式?
$('a[rel=modal]').on('click', function(evt) {
evt.preventDefault();
var modal = $('#modal').modal();
modal
.find('.modal-body')
.load($(this).attr('href'), function (responseText, textStatus) {
if (textStatus === 'success' ||
textStatus === 'notmodified')
{
modal.show();
}
});
});
的問題是,該模式的節目和1-2秒鐘後,裏面的內容顯示和擴展模式,因此它是一種「跳躍」。有沒有辦法延遲模態的加載,直到收到內容爲止?
當你使用'$('#modal')。modal();'時,模態被調用,這就是爲什麼你在加載內容之前看到它的原因。我不知道你爲什麼使用'.show()',它不用於動畫,並且看起來並不相關http://api.jquery.com/show/。而不是使用'.load()'使用ajax請求並在成功調用並填充模式。 –