which is the condition I should use for proper working?

Home / Uncategorized / which is the condition I should use for proper working?

Question:
I am new in developing and new to Stack Overflow too. This is my first question. I’m stuck in a problem that I am describing below:$(document).ready(function() {
$(".header").click(function() {
if ($(".header-content").is(‘:visible’)) {
$(".header-content").slideUp(600);
}
else {
$(this).next(".header-content").slideDown(600);
}
});
I uploading images of my project.

first Image is when we load the page. Second images is when i click on second div named tracking

I want to write code for this functionality in which. 1. when I load the page all div with class header should be like same as in first image.

when i click on any area of any one of from thee div. the class named header-content should be display block initially it is set display:none in css.

when i click on other div except from open div it should closed the open div first and open the current div which was clicked.

and at last when i click on same div twice it should close that div.

I hope you can understand my problem now.

Thanks for the help in advance.


Answer:
Your posted question already asked here so many times. So, use ask question only if you do not find what you’re looking for.

As from I get your question, you want to toggle .header-content classed element on click on .header. In case you can use Toggle function of jQuery. like below:$(document).ready(function(){
$(".header").click(function(){
$(".header-content").toggle("slow");
});
});
You can use duration of this toggle effect using parameter. Replace "slow" accordingly.
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *