sparkbox / Custom-Selectbox

Select box UI replacement
70 stars 25 forks source link

Multiple select boxes #5

Closed ali997 closed 12 years ago

ali997 commented 13 years ago

Hi, First - thanks for great plugin it really helped me.

There is a problem when using multiple select boxes specially one under another. Drop down block wont hide when you click on another select box without choosing an option in first one. Also in that situation z-index is an issue as the second select box is displayed over drop down block of the first one. Here's a quick and dirty fix i've used to deal with this:

var viewList = function(e) {
    var $this = $(this);
    clear();
++  $('.sb-dropdown').fadeOut('fast');
    $this.closest('.sb-custom').find('.sb-dropdown').fadeIn('fast');
++  $('.sb-dropdown').css("z-index","99");
++  $this.closest('.sb-custom').find('.sb-dropdown').css("z-index","100");
    e.preventDefault();
};

After this fix you can encounter an problem with flashing drop down after making selection. I still don't know how to fix it. For now i've just deleted focus binding for drop down.

cstickel commented 13 years ago

i fixed the closing bug with the following change:

            $('.sb-dropdown').not($(e.target).closest('.sb-custom').children('.sb-dropdown')).fadeOut('fast');
        };

don't have any problems with "flashing drop downs".