Topic: help with a jquery menu problem (Page 1 of 1) |
|
|---|---|
|
Lunatic (VI) Inmate From: under the bed |
posted 05-13-2009 14:03
Hello |
|
Paranoid (IV) Inmate From: London |
posted 05-14-2009 10:00
This code code: $(document).ready(function(){
$(".accordion h3:first").addClass("active");
$(".accordion p:not(:first)").hide();
$(".accordion h3").click(function(){
$(this).next("p").slideToggle("slow").siblings("p:visible").slideUp("slow");
$(this).toggleClass("active");
$(this).siblings("h3").removeClass("active");
});
});
|
|
Lunatic (VI) Inmate From: under the bed |
posted 05-14-2009 23:28
Ok, I believe I grasp how it's set up... |
|
Lunatic (VI) Inmate From: under the bed |
posted 05-15-2009 13:46
|
|
Maniac (V) Inmate From: The Pool Of Life |
posted 05-15-2009 16:34
|
|
Lunatic (VI) Inmate From: under the bed |
posted 05-18-2009 15:22
Hah...yeah, I finally fixed the broken bit that was screwing the whole site up code: function initMenus() {
$('ul.menu ul').hide();
$.each($('ul.menu'), function(){
$('#' + this.id + '.expandfirst ul:first').show();
});
$('ul.menu li a').click(
function() {
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;
if($('#' + parent).hasClass('noaccordion')) {
$(this).next().slideToggle('normal');
return false;
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if($('#' + parent).hasClass('collapsible')) {
$('#' + parent + ' ul:visible').slideUp('normal');
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#' + parent + ' ul:visible').slideUp('normal');
checkElement.slideDown('normal');
return false;
}
}
);
}
$(document).ready(function() {initMenus();});
code: function initMenus() {
$('ul.menu ul').hide();
$.each($('ul.menu'), function(){
$('#' + this.id + '.expandfirst ul:first').show();
});
//start show/hide all attempts...................................................
$('#menuhide').click(
function(){
$('ul.menu li a').removeClass("menu-active");
$('ul.menu ul').slideUp('normal');
}
);
$('#menushow').click(
function(){
$('ul.menu li a').addClass("menu-active");
$('ul.menu ul').slideDown('normal');
}
);
//end show/hide all attempts...................................................
$('ul.menu li a').click(
function() {
//remove class addition:
$('ul.menu li a').removeClass("menu-active");
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;
if($('#' + parent).hasClass('noaccordion')) {
$(this).next().slideToggle('normal');
return false;
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if($('#' + parent).hasClass('collapsible')) {
$('#' + parent + ' ul:visible').slideUp('normal');
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#' + parent + ' ul:visible').slideUp('normal');
checkElement.slideDown('normal');
//add class addition:
$(this).toggleClass("menu-active");
return false;
}
}
);
}
$(document).ready(function() {initMenus();});
|
|
Nervous Wreck (II) Inmate From: |
posted 05-31-2011 11:08
Edit TP: spam removed
|