0

我有最新版本的工作:Bootbox模態未出現

  • jQuery的3.0.0.1
  • 引導3.3.6.1
  • Bootbox 4.4.0

我的HTML:

A+ Certification, Grad. 2011 Comptia 
<a id="e1658b80-0c48-e611-8277-14feb5fbeae8" class="glyphicon glyphicon-remove" title="Delete this entry" href="/[controller]/[action]/e1658b80-0c48-e611-8277-14feb5fbeae8"> </a> 

我的JavaScript,在頁面中嵌入直接benea TH刪除鏈接:

<stript type="text/javascript"> 
$(function() { 
    $('#39b75c0a-0a48-e611-8277-14feb5fbeae8').on('click', function(e) { 
    e.preventDefault(); 
    bootbox.confirm('Do you wish to delete this entry?', function(result) { 
     if (result) { window.location = $(this).attr('href'); } 
    }); 
    }); 
}); 
</script> 

我的頭:

<script src="/Scripts/modernizr-2.8.3.js"> 
<script src="/Scripts/jquery-3.0.0.js"> 
<script src="/Scripts/bootstrap.js"> 
<script src="/Scripts/bootstrap-datepicker.js"> 
<script src="/Scripts/bootstrap-switch.js"> 
<script src="/Scripts/bootbox.js"> 
<script src="/Scripts/respond.js"> 
<script src="/Scripts/jquery.validate.js"> 
<script src="/Scripts/jquery.validate.unobtrusive.js"> 
<script src="/Scripts/metisMenu.js"> 
<script src="/Scripts/jquery.slimscroll.js"> 
<script src="/Scripts/jquery.peity.js"> 
<script src="/Scripts/jquery.mask.js"> 
<script src="/Scripts/script.common.js"> 
<script src="/Scripts/script.internal.js"> 
<link rel="stylesheet" href="/Content/bootstrap.css"> 
<link rel="stylesheet" href="/Content/bootstrap-datepicker3.css"> 
<link rel="stylesheet" href="/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css"> 
<link rel="stylesheet" href="/Content/font-awesome.css"> 
<link rel="stylesheet" href="/Content/inspinia.css"> 
<link rel="stylesheet" href="/Content/style.internal.css"> 

(這些尚未精縮;生產輸出將是)

現在我已經得到了設置,試圖點擊刪除錨點實際上並不會導致瀏覽器跟着錨點href(這很好,我們要警告用戶使用模態!),但出於某種原因,模態對話框拒絕顯示。沒有灰色的屏幕,什麼都沒有。

對此提出建議?

+0

是引導3.3.6.1使用jQuery 3.0.0.1兼容?你嘗試打開一個boostrap(不是bootbox)模式嗎?你是否得到任何js錯誤? – tmg

+0

3.3.6.1沒有最高版本設置爲一個依賴:https://www.nuget.org/packages/Bootstrap之前版本3.3.6.0做https://www.nuget.org/packages/bootstrap/3.3.6 **編輯:**好吧,whattya知道... NuGet軟件包並沒有完全正確地構建,因爲它們沒有反映出適合jQuery的maxversion依賴項:https://github.com/twbs/bootstrap/blob/v3 .3.6/bower.json –

回答

0

多的事情可以做,以調試此:

哪個瀏覽器中測試你這個?

安裝螢火或Chrome中使用F12,看看你得到任何error.Post的錯誤,如果你正在如果。

使用的console.log來測試上點擊一下,你實際上是在調用並獲得你寫的點擊功能裏面。打印日誌之前和之後e.preventDefault();

如果上述內容沒有給出任何肯定的結果,您有圖書館 衝突/不兼容問題。嘗試檢查您正在使用的JS庫的版本。

我建議首先提及的例子,在http://bootboxjs.com/#usage使用的技術,並嘗試使用它們使用了相同的庫,並以相同的順序。

另外,HTML應該是這樣的使用glyphicons:

<a href="#" data-bb="confirm" class="btn btn-default"><i id="e1658b80-0c48-e611-8277-14feb5fbeae8" class="glyphicon glyphicon-remove" title="Delete this entry" href="/[controller]/[action]/e1658b80-0c48-e611-8277-14feb5fbeae8"></i></a> 
+0

實際上,如果您閱讀我的第一條評論(上圖),那是一個依賴性問題。 BootStrap 3.3.6.1的NuGet包沒有爲jQuery設置最大版本,而3.3.6.0(<3)。由於我從v3.3.6.0出來以來只用過BootStrap,所以我認爲沒有更高的依賴關係確實意味着.1與jQuery 3兼容。 –

+0

好的。所以問題解決了嗎? :) – rocktopus

+0

哦,是的。我對盲目信任NuGet依賴規則感到非常愚蠢。顯然,並非每個包裝都設置得當。 –