0

我从这个链接http://jqueryui.com/demos/dialog/#animated使用 jquery ui用于在 MVC4 应用程序中不起作用的对话框

这是我的视图@{ ViewBag.Title = "Dialog";

}
<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 -->
4

2 回答 2

0

你没有连接你的javascript。尝试这个:

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

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

(删除开头的“ $(function () {”和结尾的“ });”对 - 您的代码希望看起来像上面。

于 2012-07-19T12:20:46.537 回答
0

添加 $(documnet).ready然后在其中定义您的函数。. ..

   $(document).ready(function () {

    code goes here  . . 
    });`
于 2013-12-19T06:55:22.540 回答