2012-07-19 72 views
0

我用jQuery用戶界面從這個鏈接http://jqueryui.com/demos/dialog/#animated的對話框未在MVC4應用工作的Jquery在MVC4對話框

這是我的看法 @ { ViewBag.Title =「對話」;

} 
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" /> 
<link href="../../Content/themes/base/jquery.ui.dialog.css" rel="stylesheet" type="text/css" /> 
<script src="../../Scripts/jquery-ui-1.8.11.js" type="text/javascript"></script> 
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script> 
<script type="text/javascript"> 
    // increase the default animation speed to exaggerate the effect 
    $.fx.speeds._default = 1000; 
    $(function() { 
     $("#dialog").dialog({ 
      autoOpen: false, 
      show: "blind", 
      hide: "explode" 
     }); 

     $("#opener").click(function() { 
      $("#dialog").dialog("open"); 
      return false; 
     }); 
    }); 
</script> 
<div class="demo"> 
    <div id="dialog" title="Basic dialog"> 
     <p> 
      This is an animated dialog which is useful for displaying information. The dialog 
      window can be moved, resized and closed with the 'x' icon.</p> 
    </div> 
    <button id="opener">Open Dialog</button> 
</div> 
<!-- End demo --> 
<div class="demo-description"> 
    <p> 
     Dialogs may be animated by specifying an effect for the show and/or hide properties. 
     You must include the individual effects file for any effects you would like to use.</p> 
</div> 
<!-- End demo-description --> 
<div class="demo-description"> 
    <p> 
     A modal dialog prevents the user from interacting with the rest of the page until 
     it is closed.</p> 
</div> 
<!-- End demo-description --> 
+1

你可以發佈一些代碼,或給一些更多的信息如何以及爲什麼這工作不適合你? – lukkea 2012-07-19 12:00:39

+0

的對話框中的jQuery UI的代碼是在鏈接 – user1501399 2012-07-19 12:02:32

+0

我們需要知道如何是 試圖使用該鏈接中的代碼。我幾乎可以保證該鏈接中的代碼是好的,所以我們需要知道你是如何使用它的。 – lukkea 2012-07-19 12:05:23

回答

0

您沒有接線您的JavaScript。試試這個:

$('#dialog').dialog({ 
    autoOpen: false, 
    show: "blind", 
    hide: "explode" 
}); 

$(document).ready(function(){ 
    $('#opener').click(function() { 
      $('#dialog').dialog("open"); 
      return false; 
    }); 
}); 

(刪除開始「$(function() {」和結束「});」對,這一點 - 你的代碼要看起來像上面

+0

我試過這個,但我仍然沒有得到任何對話 – user1501399 2012-07-19 12:28:50

+0

看看這個jsfiddle,看看它是否可以幫助你... http://jsfiddle.net/NucBs/1/ – lukkea 2012-07-19 12:40:22

+0

我應該從MVC4添加任何額外的腳本,因爲我使用的代碼是在jfiddle – user1501399 2012-07-19 12:46:31

0

添加$(documnet).ready,然後在其中定義功能。 ..

$(document).ready(function() { 

    code goes here . . 
    });`