1
你好,我有頁與模態窗口我與這個打開Twitter的引導模式窗口遮陽JS代碼:不關閉
$('.open-modal').on('click', function (event) {
event.preventDefault();
var object = $(this);
modals(object.attr('href'))
})
function modals(href) {
$("#Modal").modal("hide");
$.ajax({
url: href,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: 'html',
//data: { id: $(this).attr('id') },
error: function (data) {
alert("wystąpił nieokreślony błąd " + data);
},
success: function (data) {
$('.modal-body').html(data);
$("#Modal").modal('show');
$('.ChangeToEdit').on('click', function (event) {
$("#Modal").modal('hide');
event.preventDefault();
var object = $(this);
modals(object.attr('href'))
})
}
});
}
和HTML:
<div class="modal fade" id="Modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
和示例按鈕:
<a class="open-modal" href="/User/Edit/14">Edit</a> |
<a class="open-modal" href="/User/Details/14">Details</a> |
<a class="open-modal" href="/User/Delete/14">Delete</a>
如果用戶使用詳細信息打開模態,他將找到具有詳細信息的模態,並按鈕編輯該數據。按下該按鈕後,模式窗口應該關閉並在編輯時打開新窗口。 不幸的是。當用戶在細節模式上使用編輯按鈕時,即使編輯模式關閉,也會出現第二個「陰影」並保持在那裏。
我在做什麼錯了?爲什麼第一個模態的第二個陰影沒有消失?
有可能使用ajax獲取包含引導腳本標記嗎?我想不止一次包括bootstrap可能會導致類似的問題。 –
您可以提供呈現的HTML,而不是「@ Html.ActionLink ...」。 – dfsq
@dfsq我用按鈕樣例更新了我的問題。羅伯特它不是Bootstrap只包含在佈局中。其他頁面沒有帶引導程序的腳本標籤。當我嘗試從「細節」模式轉到「編輯」模式時,只會顯示更多此錯誤。當我點擊編輯時,一切都像魅力一樣 – szpic