DotNetNuke Jquery doesnt work in module

帅比萌擦擦* 提交于 2019-12-12 01:29:10

问题


I have a JQuery file that works fine on a normal webpage, but doesn't work inside of DNN.

DNN is pointing at the latest version of JQuery in the Host settings I have a container called news containing (news.css, news.ascx) and a module called newsdata.ascx inside of the container.

I have this code in the module to start launch the JQuery file:

<script type="text/javascript">
    $(function() {  
        $("#controller").jFlow({  
            slides: "#slides",  
            width: "277px",  
            height: "150px",  
            duration: 250  
        });  
    });  
</script>

But nothing happens. Am I placing the code in the correct locations?

Thanks


回答1:


I would guess that you've run into an issue where $ isn't referring to jQuery. Try changing the first line to jQuery(function ($) {




回答2:


I figured this one out the hard way. To get your jQuery working on a DNN page, you must first instantiate it. To do this:

 DotNetNuke.Framework.jQuery.RequestRegistration()

If you don't the core jQuery may never be added to the page.

http://www.dotnetnuke.com/Resources/Wiki/Page/jQuery.aspx



来源:https://stackoverflow.com/questions/6293094/dotnetnuke-jquery-doesnt-work-in-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!