Line 8: | Line 8: | ||
document.getElementById(id).classList.toggle("show"); | document.getElementById(id).classList.toggle("show"); | ||
} | } | ||
+ | |||
+ | $(document).click(function (e) { | ||
+ | e.stopPropagation(); | ||
+ | var container = $(".dropDown"); | ||
+ | |||
+ | //check if the clicked area is dropDown or not | ||
+ | if (container.has(e.target).length === 0) { | ||
+ | $('.subMenu').hide(); | ||
+ | } | ||
+ | }) | ||
// Close the dropdown if the user clicks outside of it | // Close the dropdown if the user clicks outside of it | ||
Line 18: | Line 28: | ||
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</script> | </script> |
Revision as of 00:32, 28 October 2017