jQuery only works when signed in?

Permalink 1 user found helpful
I am trying to add a jQuery accordion menu onto one of my pages. I included the script src in my header.php like this

<script src="<?php echo $this->getThemePath()?>/js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>


and as long as I am signed into the site, it works perfect. But as soon as I sign out, it disappears and becomes a regular list?

I added the code in an HTML block, looks like this,
<script type="text/javascript">
   $(function() {
      $("#accordion").accordion({ collapsible: false });
   });
   </script>
<div class="accordion">
<div id="accordion">
   <h3><a href="#">Section 1</a></h3>
   <div>
      <p>Content Here</p>
   </div>
   <h3><a href="#">Section 2</a></h3>
   <div>
      <p>Content Here</p>
   </div>


Any ideas, I am stumped here? Thank you.

 
Tony replied on at Permalink Reply
Tony
it's probably just not including some other required library after you log out.

have a look at the source when you're logged out. is jquery included? is so, then maybe you need some other library included within your theme's header like:

$html = Loader::helper('html');
$view = View::getInstance();
$view->addHeaderItem( $html->javascript('jquery.ui.js') );
$view->addHeaderItem( $html->css('jquery.ui.css') );

...which would have to be added before calling

Loader::element('header_required');

which you should have already