admin管理员组

文章数量:1323330

I have created custom DNN module that should use some JQuery plugins.
I loaded plugins fine.
But getting error:

Uncaught TypeError: undefined is not a function imagesloaded.js?cdv=18:93
Uncaught TypeError: Object [object Object] has no method 'imagesLoaded' Masonry:755
GET http://dnn7site/jquery.min.map 404 (Not Found) Masonry:464
GET http://dnn7site/resources/shared/scripts/jquery/jquery.min.map 404 (Not Found)

And I think that this is because JQuery is not imported in my custom module. I included other JS files like:

<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/jquery.infinitescroll.min.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/masonry.pkgd.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/imagesloaded.js"  />

But I don't know how to import JQuery, any help?
I am using DNN 7.1.1

I have created custom DNN module that should use some JQuery plugins.
I loaded plugins fine.
But getting error:

Uncaught TypeError: undefined is not a function imagesloaded.js?cdv=18:93
Uncaught TypeError: Object [object Object] has no method 'imagesLoaded' Masonry:755
GET http://dnn7site/jquery.min.map 404 (Not Found) Masonry:464
GET http://dnn7site/resources/shared/scripts/jquery/jquery.min.map 404 (Not Found)

And I think that this is because JQuery is not imported in my custom module. I included other JS files like:

<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/jquery.infinitescroll.min.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/masonry.pkgd.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/imagesloaded.js"  />

But I don't know how to import JQuery, any help?
I am using DNN 7.1.1

Share asked Sep 1, 2013 at 9:17 11101110 6,83956 gold badges186 silver badges346 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

Don't include jquery using the method described in the other answer. This will potentially cause conflicts with the jquery version that may be bundled with your DNN installation and/or other modules.

To include jQuery in DNN, it's as follows:

DotNetNuke.Framework.jQuery.RequestRegistration()

If you want jquery UI, use:

DotNetNuke.Framework.jQuery.RequestUIRegistration()

If you want to do it through a ASCX file, use this:

<%@ Register TagPrefix="dnn" TagName="JQUERY" Src="~/Admin/Skins/jQuery.ascx" %>
<dnn:JQUERY ID="dnnjQuery" runat="server" />

More information can be found here:

http://www.dnnsoftware./wiki/Page/jQuery

The version of jquery and whether it uses a hosted file can be configured in host settings -> advanced settings -> jquery settings.

If jQuery is required, try downloading the jQuery library and placing the jQuery script file in the same location as the other script files, and ensure that the jQuery library is reference before any other script files that require jQuery. For example:

<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/jquery-1.9.1.min.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/jquery.infinitescroll.min.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/masonry.pkgd.js"  />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/.demo.masonry/Scripts/imagesloaded.js"  />

However, the Masonry documentation suggests that jQuery is not required to run the plugin, so your problem may lie elsewhere

jQuery is not required to use Masonry. But if you do enjoy jQuery, Masonry works with it as a jQuery plugin.

本文标签: javascriptHow to import JQuery to custom dnn moduleStack Overflow