Hi im relativley new to jQuery, and am trying to place a nice slide in effect into a page using a few divs. Now everything works fine when im logged in (100% valid) however as soon as i log out it doesnt work, i get 1 script error and fire bug gives me the following message :

$ is not defined

The js is been imported into the page.tpl.php via this line of code:

<script type="text/javascript" src="<?php print $base_path . path_to_theme() ?>/js/jquery.accordian.js"></script>

the jquery code is as follows:

$(document).ready(function() {
  $('div.ntype-page> h3+div, h3.accordian+div').hide().prev().addClass('hidden').append('<span class="collapsable">see more</span>');
  $('div.ntype-page> h3, h3.accordian').click(function() {
	 	$(this).toggleClass('hidden').toggleClass('active')
	 		.siblings('h3').removeClass('active').addClass('hidden');;
		var $nextDiv = $(this).next();
		var $visibleSiblings = $nextDiv.siblings('div:visible');
		if ($visibleSiblings.length ) {
			$visibleSiblings.slideUp('fast', function() {
			$nextDiv.slideToggle('fast');
		});
		} else {
			 $nextDiv.slideToggle('fast');
		}
  });
});

when i use firebug and compare the difference between logged in and not logged in it appears that the jQuery.js (version 1.2.6) is only been loaded into drupal when im logged in.

Any help would be much appreciated.

Comments

bobmcjob’s picture

Version: 6.x-1.x-dev » 5.x-1.0
Status: Active » Closed (fixed)