Best Practice for adding jQuery to a skin
Last Post 01/11/2010 9:09 PM by Joseph Craig. 1 Replies.
Author Messages
Angela
Nuke Newbie
Nuke Newbie
Posts:3


--
01/11/2010 4:13 PM  
I'm building an ascx skin that uses the House Menu skin object. I want to use jQuery to add some CSS classes to certain LI items and maybe some other stuff too. In order to do this I want to create an external JavaScript file which will consist of these functions and possibly other global jQuery stuff as well. How can I load this file from my skin.ascx in the head section of the page, but after jQuery is loaded? I found this link which tells me how I can load the JS file from within my skin:

http://blogs.snapsis.com/CommentVie...406d8.aspx

Seems to work well for adding scripts before jQuery, but it seems that I can't add the JS file to page after jQuery is loaded. I'm new to DNN but experienced with XHTML and jQuery. It would also be nice to do something similar with containers. Until I learn more about building custom modules, a container seems like a good place to call JS that will only be used on pages with certain content.

I like the idea of packaging all necessary files, including JS with my skin. Any resources or links to best practices related to this subject would be appreciated. I've been hunting for good info on this topic for days, and have yet to come up with anything really useful.
Joseph Craig
DNN MVP
Posts:11667


--
01/11/2010 9:09 PM  
First of all, let's make sure that you are using DotNetNuke 5.x.  It's a very jQuery-friendly system.

For some good information on using jQuery with DotNetNuke look at the blogs from Joe Brinkman (via DotNetNuke.com) and Will Strohl (google him and you'll find him).

As for packaging skins, and up-to-date skin information, Timo Breumelhof's blod -- also on DotNetNuke.com.  Our recent skinning tutorials address 5.x issue specifically.  The older tutorials are still valid.

Finally, I don't want to talk you out of using the House menu, but there are newer menus built for current versions of DotNetNuke.  I think that the current DotNetNuke Nav Menu is a pretty good choice, but there are others.  Google around and you'll find them.  (And perhaps others with different ideas will correct my opinions!)

Joe Craig, Patapsco Research Group
Complete DNN Support


---