I am trying to make a responsive menu. Once this menu expands, the div with the class of container will shrink to make room for this menu. As of right now, the menu will open but it does not close once one of the buttons are clicked again. Is there any jQuery selector to make it so when any where outside of this menu is clicked, or when one of the "-btn" classes are clicked the container div will go back to it's original size?
HTML
<nav>
<a href="#" id="company-information-btn">
<i class="fa fa-info-circle"></i>
<p>Company Information</p>
</a>
<hr>
<a href="#" id="faq-btn">
<i class="fa fa-question-circle"></i>
<p>FAQ</p>
</a>
<hr>
<a href="#" id="personalize-btn">
<i class="fa fa-magic"></i>
<p>Personalize</p>
</a>
<hr>
<a href="#" id="services-btn">
<i class="fa fa-gift"></i>
<p>Services</p>
</a>
<hr>
<a href="#" id="portfolio-btn">
<i class="fa fa-desktop"></i>
<p>Portfolio</p>
</a>
<hr>
<a href="#" id="contact-btn">
<i class="fa fa-envelope-o"></i>
<p>Contact Information</p>
</a>
<hr>
<a href="#" id="testimonials-btn">
<i class="fa fa-users"></i>
<p>Testimonials</p>
</a>
</nav>
<div class="content" id="company-information>
...
</div>
<div class="content" id="FAQ">
...
</div>
etc...
jQuery
$('.profile-create_nav nav a').click(function(event) {
event.preventDefault();
// $('.profile-create_nav nav a').removeClass('active');
// $(this).addClass('active');
$('.container').addClass('smaller');
$('.profile-create_nav .content').fadeToggle(300);
$('.profile-create_nav #services').show();
$('.move_down').hide();
});
//Aside nav for microsite
$('#company-information-btn').click(function() {
$('.content').addClass('hidden');
$('#company-information').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#company-information-btn').addClass('active');
});
$('#personalize-btn, #personalize-section-btn').click(function() {
$('.content').addClass('hidden');
$('#personalize').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#personalize-btn').addClass('active');
});
$('#faq-btn, #faq-section-btn').click(function() {
$('.content').addClass('hidden');
$('#faq-section').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#faq-btn').addClass('active');
});
$('#services-btn, #services-section-btn').click(function() {
$('.content').addClass('hidden');
$('#services').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#services-btn').addClass('active');
});
$('#portfolio-btn, #portfolio-section-btn').click(function() {
$('.content').addClass('hidden');
$('#portfolio-section').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#portfolio-btn').addClass('active');
});
$('#testimonials-btn, #testimonials-section-btn').click(function() {
$('.content').addClass('hidden');
$('#testimonials-section').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#testimonials-btn').addClass('active');
});
$('#contact-btn, #contact-section-btn').click(function() {
$('.content').addClass('hidden');
$('#contact-information').removeClass('hidden');
$('.profile-create_nav nav a').removeClass('active');
$('#contact-btn').addClass('active');
});
Thanks, Adam.