We help IT Professionals succeed at work.
Get Started

jQuery Toggel Close all

Robert Granlund
on
82 Views
Last Modified: 2015-09-24
I have this jQuery function that toggles open divs when a certain class is clicked:
<script>
jQuery(document).ready(function() {
	jQuery('.laser-nav-display').click(function() {
		jQuery('.nav-lasers').slideToggle("slow", function() {
			
		});
	});
	jQuery('.app-nav-display').click(function() {
		jQuery('.nav-applications').slideToggle("slow", function() {
			
		});
	});
	jQuery('.support-nav-display').click(function() {
		jQuery('.nav-support').slideToggle("slow", function() {
			
		});
	});
	jQuery('.company-nav-display').click(function() {
		jQuery('.nav-company').slideToggle("slow", function() {
			});
		});
	jQuery('.accept').click(function() {
		jQuery('.agreement').show("slow", function() {
			
		});
	});
});
</script>

Open in new window

However, when I click on one, I want the others to close instead oe.staing open. So there is only one open at a time.  How do I go about this?
Comment
Watch Question
Top Expert 2013
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE