question about jquery nav
PermalinkI got the basic functionality working by making an auto-nav style but its ignoring the jquery i have in the view.php is there anything special i have to do to get this to work I know that concrete has jquery included in it somewhere, but for the moment i just tested by copying my own jquer lib into the auto-nav style folder I made.
any help would be great.
so far it populates the links on the nav bar just fine, but dosent seem to populate sub links, im working a nice pop down menu with sub page links
or do you think this kinda thing is better to create as a block instead of just augmenting the auto-nav
basically im replicateing this
http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html...
here is the js that makes the nave work the way i want.
$(document).ready(function(){
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
$("ul.topnav li span").click(function() { //When trigger is clicked...
//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
});
//Following events are applied to the trigger (Hover events for the trigger)
}).hover(function() {
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function(){ //On Hover Out
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
});
});
You can check whether or not the sub-menu html is being outputted by using Firebug or by viewing the page source.
If the html is being outputted properly, then check that the javascript code is referring to the various elements with the same id's and classes as the html that's actually being output. For example, in the javascript code you posted, it looks like it's expecting classes called "topnav" and "subnav", but I believe the default autonav template uses different names. So you need to either change the javascript, or change the template so they match.
Hope this helps.
-Jordan
<script src="<?php print $this->getThemePath(); ?>/myjavascriptfile.js"></script>
Any thoughts....
This may not be the cause of your problem, but it is the first thing to try to fix it. If it's still not working, could you post some code with more details about what exactly isn't working?
Also, do you know about the Firebug extension for Firefox? This is an essential tool for tracking down javascript issues -- it lets you set breakpoints in the code, shows you variables, lets you try out different calls in a console, etc.
Good luck!
-Jordan