Linking existing jQuery libraries and images

Permalink
I am having trouble making some jQuery functions work on my default template. I am working under a subdomain called 'dev'

I have the code as:
<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../js/jquery.bgpos.js"></script>
<script type="text/javascript" src="../shadowbox/shadowbox.js"></script>


I also have a bunch of images in an image folder on the server but they are not being pulled onto the page.

I use the path images/bob_photo.jpg etc

Also can't get autonav to use lightboxes but that is another forum thread...

trixiemay
 
tallacman replied on at Permalink Reply
tallacman
You have to call the script correctly to grab it. If you load your page with Safari's Web Inspector or Firebug in FF you'll probably see that you have errors on your page that correspond to your files.

For the correct way I highly recommend visiting Weblicating's web site here:http://www.weblicating.com/c5/cheat-sheet/... where all will become known.


Steve
jordanlev replied on at Permalink Reply
jordanlev
To further clarify tallacman's response...
First of all, don't include jquery because c5 already does that automatically (so you only need the 2nd and 3rd of your scripts included).

Second, you need to insert the code "<?php echo $this->getThemePath(); ?>" in your src's instead of the "..", so:
<script type="text/javascript" src="<?php echo $this->getThemePath(); ?>/js/jquery.bgpos.js"></script>
<script type="text/javascript" src="<?php echo $this->getThemePath(); ?>/shadowbox/shadowbox.js"></script>

(that is assuming the jquery.bgpos.js file is inside a folder called "js" in your theme directory, and shodowbox.js is inside a folder called "shadowbox" in your theme directory)

Finally, you need to do a similar thing with the images in order for them to load:
<img src="<?php echo $this->getThemePath(); ?>/images/myimagename.jpg" />

(assuming the image is inside a folder called "images" in your theme directory)

One exception to the above rule -- if you are referring to images from your CSS file (e.g. "background: url(myimage.jpg)"), then you do NOT use the php code -- you just use the normal "../images/myimage.jpg" thing.

Hope that helps!

-Jordan