Hi people I need help with my navigation-system. My currently situation is the following:
I've got a "closer" on my website, a button, that allows a close- function to the upper div-element, in which the closer seats. One level higher. It's the only parent-element with a "closer" on the website. My code: $('.closer').click(function () { $('div:has(.closer)').fadeOut(2000); }); It's really simple. Every div-element, that contains the closer-class, in my case all of them, will have a fadeOut. And it works great. By click on the closer-class the upper (...higher) parent-div will be close. My problem. I've got an other function, that allows to fadeIn the same div: $('.page1').click(function () { $('#content, #philosopie, #kontakt, #curriculumvitae').fadeOut (2000); $('#ueberuns').fadeIn(2000); }); The ID = #ueberuns is the same div as the upper one in the instruction above! But it won't work well. Why? The meaning goes to the same Div? I can't understand it. A solution would be: $('#ueberuns').fadeIn(2000); change to = $('div:has(.closer)').fadeIn(2000); It would work great, BUT (!) I've got other divs, layered one upon the other, which are also got a fadeIn and the user will see all layered. Terrible! :-) My first solution was quiet simple. I had for every "closer" a seperate function, that response to seperate IDs etc. It works fine. Why not? But I'm interested in a minimal code-use. ;-) My first idea was, to select by jquery-selectors the upper element, like this: ...$('.closer < div').fadeOut(2000); it means in my mind = the parent-element of .closer(class), in this case a div-element, would get fade out. It doesn't work and I'm studying the selectors better. ;-) Any Idea for that? Has got jquery any selector like this? (by the way) Any Ideas for my problem? My idea is further to save code. It means: one close-function for each of the layered divs and not seperate functions, that blow up my code gigantically. regards