开发者

DotNetNuke jquery script in container

Hello I've made a container in DNN but i don't know how to implement jquery开发者_C百科 script to the container. Does anybody know how this is done?

Best Regards


To do it properly, you'll need to write some code (which you can do inside of your container). First, you'll want to request jQuery from the framework. Then, add your plugin script (the best way is probably to use Page.ClientScript, so that the script doesn't get added multiple times when the container is used multiple times on the page.

<script runat="server">
    Sub Page_Init(ByVal sender as Object, ByVal e as EventArgs) Handles Me.Init
        DotNetNuke.Framework.jQuery.RequestRegistration()
        Me.Page.ClientScript.RegisterClientScriptInclude("myscript", ResolveClientUrl("scripts/jquery.myplugin.js"))
    End Sub
</script>

I would probably alter the plugin script and include a call at the end to call the plugin on whatever elements you're enhancing:

jQuery(function ($) {
    $('.my-container .header').pluginize();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜