因此,我知道现在可以使用data-target + href加载远程内容,但是,我从ajax响应中得到的是json (我不能更改服务器端),所以我首先需要对其进行处理。
我想要显示一个微调器,我有它的CSS,但也想已经淡出当您将类" fade“添加到模式div时发生的背景。
有谁知道如何手动启动,并确保在我显示模式时动画不会重复?
发布于 2014-10-11 05:38:18
在我使用Bootstrap3的项目中,我创建了一个pleaseWait函数,我从执行AJAX调用的其他函数中调用该函数。此函数包含显示和隐藏函数。show函数将加载我希望显示的html (旋转器、文本等),而hide函数将隐藏模式。您可以添加更多的jquery来实现淡入淡出效果。
功能:
pleaseWait: function () {
var $pleaseWaitModal = null;
return {
show: function() {
$("#pleaseWaitModal").load( "pleaseWaitModal.html", function() {
$pleaseWaitModal = $(this);
$pleaseWaitModal.modal({
backdrop: "static",
keyboard: false
});
});
},
hide: function () {
// You could call JQuery's fadeTo() here to accomplish your fade effects
$("#pleaseWaitModal.modal.in").modal("hide");
}
};
}示例调用:
function myAjaxFunction() {
pleaseWait().show();
$.ajax({
// ajax options
complete : function() {
pleaseWait().hide();
}
});
}https://stackoverflow.com/questions/21580134
复制相似问题