loading .js

Topics: ASP.NET 2.0, Themes
Aug 25, 2008 at 2:03 PM
I am having some issues with loading some jquery javascript files.
I just wanted to know where the best place to put the lines to call the files.

Right now they are in the site.master of my theme folder.
The jquery code is the cycle plugin that cycles through a div and rotates the images.
The problem is no matter what I try and place the scripts it will not work.
I've tried ~/ and ../
Even targeting directly with ~/themes/...
Yet nothing works.

Where should I call the javascript, how should it be called, and where is the best place to put the scripts folder?
The div I am rotating is in the site.master

Aug 25, 2008 at 7:25 PM
Have a look at my AnimatedWidgets extension.  I use JQuery for this extension and it should be a good example for you to get started.


Aug 25, 2008 at 8:27 PM
IMO, instead of loading a local jQuery document, you can just use the Google AJAX Libraries API. All you would need is load the external script [http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js]. It is served off of a faster server, and cached virtually forever on the client.
Aug 25, 2008 at 8:34 PM
That seems very nice but how about plugins?
Aug 25, 2008 at 10:45 PM
Edited Aug 26, 2008 at 5:43 AM
MasterPageFile = Utils.RelativeWebRoot + "themes/" + _Theme + "/site.master";
(from BlogBasePage)

From that I derive:
Utils.RelativeWebRoot + "themes/" + BlogSettings.Instance.Theme + "/js/jquery-image-rotate.js");
... that is if you want to package the script with the theme, if the script is not a part of a theme then...
Utils.RelativeWebRoot + "/js/jquery-image-rotate.js");