jQuery ... is not a function error when adding in a sliding menu script.
PermalinkOn trying to add the jQuery sliding menu fromhttp://www.geektantra.com/2010/02/jquery-sliding-menu/... to my menu nav in the header.php file, I am getting the following error flagged up in Firebug:
jQuery("#HorizontalSlidingMenu .SlidingMenu").slidingMenu is not a function
The C5 site is:
http://www.treadmark.org.php5-16.websitetestlink.com/...
Using Concrete5 5.4
I have included the jQuery sliding menu .js file in the header, and jQuery is loaded according to jquerify.
Any ideas where I may be going wrong?
Taken the link to jQuery out and moved the Loader line to just after the <head> tag. Now the script doesnt return an error for the function, however the default theme image slide show now doesnt show.
do I have to closedown my jQuery script? And if so how is that done?
Thanks for the help with this :)
use a check to see if its in editmode
line back before the end of the head block fixes the issues with editing.
However breaks the jQuery again with the error:
jQuery is not defined
jQuery(function(){
<head> <!-- Site Header Content //--> <?php Loader::element('header_required'); ?> <?php $html = Loader::helper('html'); $this->addHeaderItem($html->javascript('jquery.js', 'CORE')); ?> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('main.css')?>" /> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('typography.css')?>" /> <?php if ($c->isEditMode()) { echo"edit mode" ?> <?php } else { echo"display mode"?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> <?php } ?> <script type="text/javascript" src="<?php echo $this->getThemePath()?>/js/jquery.sliding-menu.js"></script> <script type="text/javascript"> jQuery(function(){
still getting the error in firebug:
jQuery("#HorizontalSlidingMenu .slidingMenu").slidingMenu is not a function
don't know where to go from here, any more ideas or have I done something fundamentaly wrong in my header?
http://www.concrete5.org/community/forums/block_requests/jquery-lav...
I had some problem with adding html code including java inside, but when I put it in html block it always make editor bar dissapear and I can't edit that page anymore! even I can't restore it to older version of my page...
But it solved when I delete
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
After I read this discussion, I think the main problem when we got error from put javascript is because of that script...maybe?
anyway, thanks all...
jQuery is already included in C5, so there's no need to add it to your theme, as it looks like you have, from this line:
You can just take that out. Also, move Loader::element('header_required') so that it is before your reference jquery.sliding-menu.js. It should be the first thing after the HTML <head> tag.