2

我试图在我的自定义 dnn 模块中显示一个 jQuery 模态弹出窗口,为此我使用了下面的代码,它工作正常。

<div id="dialog-form" title="Notices">
    <div>
        My Notice 1
    </div>
</div>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script type="text/javascript">
    $(document).ready(function () {
        $("#dialog-form").dialog({
            modal: true,
            buttons: {
                Close: function () {

                    $(this).dialog("close");
                }
            }
        });
    });
</script>

我担心的是,在上面的代码中,我直接使用链接标记引用了 jQuery UI 文件,并且我知道 DNN 本身带有 jquery UI 文件。所以必须有一些方法来避免直接引用 UI css 文件并使用 dnn 已经自带的东西。

我尝试在后面的模块代码中使用以下行,但它们都不适合我

DotNetNuke.Framework.jQuery.RequestUIRegistration();
JavaScript.RequestRegistration(CommonJs.jQueryUI);  //obsolete in DNN7.2

我还尝试了以下链接中提到的方法 http://www.ifinity.com.au/Blog/EntryId/121/Using-jQuery-UI-with-DotNetNuke-5-and-6-in-the-same-module

4

1 回答 1

0

为了注册 jquery 和 jquery UI,你应该调用:

using DotNetNuke.Framework.JavaScriptLibraries;
//...

JavaScript.RequestRegistration(CommonJs.jQuery);
JavaScript.RequestRegistration(CommonJs.jQueryUI);

于 2014-10-15T09:36:15.647 回答