2016-07-06 18 views
0

我想用引導模態窗口替換當前的dhtmlx模態窗口。我的應用程序當前使用容器來存儲dthmlx模式窗口的實例並使用它。創建並打開引導模態窗口

myContainer = new dhtmlXWindows(); 

我想要做自舉相同,但我似乎無法能夠打開一個引導模式的情況下,即使是在的jsfiddle。

我發現an exemple of what I want to do,看起來像這樣:

var dialogInstance = new BootstrapDialog({ 
    title: 'Dialog instance', 
    message: 'Hi Apple!' 
}); 
dialogInstance.open(); 

但是這個代碼沒有什麼the JSFiddle I created to test it

您對如何解決我的問題有想法嗎?我不想使用HTML代碼來創建對話框,我需要像在我的小提琴中那樣使用JS代碼。

無論如何。

回答

0

// Using init options 
 
     var dialogInstance1 = new BootstrapDialog({ 
 
      title: 'Dialog instance 1', 
 
      message: 'Hi Apple!' 
 
     }); 
 
     dialogInstance1.open(); 
 
     
 
     // Construct by using setters 
 
     var dialogInstance2 = new BootstrapDialog(); 
 
     dialogInstance2.setTitle('Dialog instance 2'); 
 
     dialogInstance2.setMessage('Hi Orange!'); 
 
     dialogInstance2.setType(BootstrapDialog.TYPE_SUCCESS); 
 
     dialogInstance2.open(); 
 
     
 
     // Using chain callings 
 
     var dialogInstance3 = new BootstrapDialog() 
 
      .setTitle('Dialog instance 3') 
 
      .setMessage('Hi Everybody!') 
 
      .setType(BootstrapDialog.TYPE_INFO) 
 
      .open();
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
 
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> 
 

 
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script> 
 
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.5/css/bootstrap-dialog.min.css"> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.5/js/bootstrap-dialog.min.js"></script>

參見:http://www.jqueryscript.net/demo/jQuery-Modal-Dialog-Plugin-For-Bootstrap-3-Bootstrap-3-Dialog/examples/

參見:http://www.jqueryscript.net/lightbox/jQuery-Modal-Dialog-Plugin-For-Bootstrap-3-Bootstrap-3-Dialog.html

+0

是的,但這不是用一個實例。我可以使用'.show()',它可以正常工作,但不能在使用實例時使用,例如'myContainer = new dhtmlXWindows();',這是我需要使用它的方式。 –

+0

回答更新,請查看 –

+0

大聲笑,這正是我粘貼在我的問題中的代碼。無論如何,它表明它工作。我的工作不工作的原因是缺乏引導對話框js文件。我以爲bootstrap.js文件包含所有內容......無論如何感謝 –