I'm encountering a problem with my JavaScript - attempting to make this function properly.
Firstly, here is the desired functionality:
1.)
Add or remove the 'active' class from the parent element when clicked
2.)
When clicking inside the child element, it closes - I need assistance in preventing that behavior... I want the child element to remain open if any clicks occur within it...
3.)
Is there a way to enable closing the child element by clicking anywhere on the page, rather than only being able to close it by clicking on the parent element?
JavaScript:
$(document).ready(function () {
$("#logsterIn_profile").click(function () {
$(".logsterIn_profile").slideToggle('200');
$("#logsterIn_profile").addClass('active');
});
});
To view the current implementation, check out DEMO ON FIDDLE
Any assistance would be greatly appreciated!