Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...WhatWhat's the best way to inject JS / jQuery in an ASCX skin?
Previous
 
Next
New Post
2/2/2010 7:08 AM
 

Hi

I want to insert some Javascript / jQuery into my ASCX skin, and want to know what is the best way to do it?

In the past, I have used the following just below my controls registration (having used the hosted version of jQuery native to DNN 5):

<script type="text/javascript" src="<%=skinpath%>js/easySlider1.7.js"></script>

OR...

<script type="text/javascript">
$(document).ready(function(){ 
$("#slider").easySlider({
auto: true,
continuous: true
});
});
</script>

...But I'm not sure this is the best way to do it.

I know Armand D has made references to using jQuery in a couple of threads. Armand - Perhaps you could help..? Otherwise, anyone else who could give insight. I know there was an article by that talks about jQuery in DNN by Joe Bronkman (http://blog.theaccidentalgeek.com/), but I want a code snippet example, please... ...if possible.

Thanks in advance.


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
2/2/2010 7:39 AM
 

Jon,

  I don't see any issue with the two methods you provided.  I personally prefer the first option since it allows the browser to cache the javascript so your users will only see a performance hit on the first page request.


Joe Brinkman
DNN Corp.
 
New Post
2/2/2010 7:43 AM
 

 As Joe said, the first method is our prefered  way too. 

Salar

 
New Post
2/2/2010 9:13 AM
 
Joe Brinkman wrote:

Jon,

  I don't see any issue with the two methods you provided.  I personally prefer the first option since it allows the browser to cache the javascript so your users will only see a performance hit on the first page request.

 

Hi Joe

Thanks for your answer. Appreciated it.

I saw on the Skinning Forum a few weeks ago a thread on some ASCX injection script that inserts this into the head of the page... What are your thoughts in this..? (See: http://www.dotnetnuke.com/Community/F...) Has anyone tried this? Does it work? Would it's use be worth considering or is everyone's opinion that it is ok to have JS / jQuery calls scattered throughout a site's markup?


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
2/2/2010 9:18 AM
 

With DNN 5 you don't really have a need to inject the Jquery, but it's a valid method as well.  Personally, I don't like loading anythinn that's not going to be used, so I would do it in the skin, but if the code was to be used everywhere and you had multiple skins it might make sense.  Or use a skin widget, you don't need to change the skins, just the widget.

Jeff

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...WhatWhat's the best way to inject JS / jQuery in an ASCX skin?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out