Hi everyone,
I have spent 2 days banging my head against the jagged edges of this code. I and trying to create a ice expanding menu on teh left side of my site. I have jquery working in other places for others thigns but for some reason this one piece wont work correctly.
I have my list of nav elements being printed nicely and when I click on an item it appears as though ti tries to expand the sub element but there appears only a very thin line. All of the elements of the sub ul are not showing. Or I shoudl say it slides maybe 1 pixel down instead of the autoheight of the sub elements. My code for the menu is below and then below that is the jquery fucntions. Any help is greatly appreciated.
<ul id="menu" class="menu">
<li class="node" sizcache="0" sizset="0">
<a class="top" jQuery1268306678868="14">Header 1</a>
<ul style="DISPLAY: none" class="FCTitem" jQuery1268306678868="2">
<li style="DISPLAY: block">
<a href="sub href1">
sub link 1</a></li>
<li style="DISPLAY: block">
<a href="sub href 2">
sub href 2</a></li>
<li style="DISPLAY: block">
<a href="sub href 3">
sub href 3</a></li>
</ul>
</li>
<li class="node" sizcache="0" sizset="1">
<a class="top" jQuery1268306678868="15">Header 2</a>
<ul style="DISPLAY: none" class="FCTitem" jQuery1268306678868="3">
<li style="DISPLAY: block">
<a href="sub href 1">
Sub href 1</a></li>
<li style="DISPLAY: block">
<a href="SUb href 2">
Search</a></li>
<li style="DISPLAY: block">
<a href="Sub Href 2">
Sub Href 2</a></li>
</ul>
</li>
<li class="node" sizcache="0" sizset="2">
<a class="top" jQuery1268306678868="16">Header 3</a>
<ul style="DISPLAY: none" class="FCTitem" jQuery1268306678868="4">
<li style="DISPLAY: block">
<a href="Sub href 1">
Sub Href 2</a></li>
<li style="DISPLAY: block">
<a href="Sub Href 2">
Sub Href 2</a></li>
</ul>
</li>
</ul>
$.fn.initMenu = function() {
return this.each(function(){
var theMenu = $(this).get(0);
$('.FCTitem', this).hide();
$('li.current > .FCTitem', this).show();
$('li.current > .FCTitem', this).prev().addClass('opened');
$('li.node a.top', this).click(
function() {
var theElement = $(this).next();
var parent = this.parentNode.parentNode;
if($(parent).hasClass('noaccordion')) {
$(theElement).slideToggle('normal', function() {
if ($(this).is(':visible')) {
$(this).prev().addClass('opened');
}
else {
$(this).prev().removeClass('opened');
}
});
return false;
} else {
if(theElement.hasClass('FCTitem') && theElement.is(':visible')) {
if($(parent).hasClass('opened')) {
$('.FCTitem:visible', parent).first().slideUp('normal',
function() {
$('.FCTitem:visible', parent).first().prev().removeClass('opened');
}
);
}
return false;
}
if(theElement.hasClass('FCTitem') && !theElement.is(':visible')) {
$('.FCTitem:visible', parent).first().slideUp('normal', function() {
$(this).prev().removeClass('opened');
});
theElement.slidedown('normal', function() {
$(this).prev().addClass('opened');
});
return false;
}
}
return false;
}
);
});
};
$(document).ready(function() {$('.menu').initMenu();});
$(document).ready(function() {
$('a.top').hover(function() {
$(this).stop().animate( {
paddingRight:"30px"
}, 300);
}, function() {
$(this).stop().animate( {
paddingRight:"15px"
}, 300);
});
});