12345678910111213141516171819202122232425262728293031323334353637383940 |
- !function($) {
-
- var dropdownToggle = '.J_dropdown';
- $(document).off('click',dropdownToggle).on('click',dropdownToggle, function() {
- var $this = $(this), isActive;
- if ($this.is('.disabled, :disabled')) return;
- isActive = $this.hasClass('open');
- clearMenus();
- if (!isActive) {
- $this.css('position', 'relative');
- $this.toggleClass('open');
-
- $(document).on('click', function(e) {
- var target = $(e.target);
- if (target.closest(".J_dropdown").length == 0) {
- clearMenus();
- };
- });
- };
- });
- function clearMenus() {
- $(dropdownToggle).each(function() {
- $(this).removeClass('open');
- $(this).css('position', '');
- })
- }
-
-
- }(window.jQuery);
|