Created
May 19, 2014 09:35
-
-
Save ErDmKo/5bcb32f9cfddf2eb659d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').on('click', '.open_close_sel', function(e){ | |
var self = $(this); | |
popup = self.children('dd'), | |
group = self.add(popup); | |
$('.open_close_sel > dd').filter(function(e){ | |
return !$(this).is(popup) | |
}).removeClass('open').closest('.open_close_sel').removeClass('open'); | |
$(document).off('.custom_select').on('click.custom_select', function(e, f){ | |
if (f) | |
return; | |
var elem = $(e.target); | |
if (elem.closest('.open_close_sel').length) | |
{ | |
var parent_cont = self.children('dt') | |
if (elem.is(parent_cont) || elem.is(self) || elem.closest(parent_cont).length) | |
{ | |
group.toggleClass('open'); | |
} | |
else if (!self.is('.multi')) | |
group.removeClass('open'); | |
} | |
else | |
{ | |
group.removeClass('open'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment