Tries to use a scrollbar in a selectbox container. Hides the container.

Here's my example.

I am using a slightly modified version of the selectbox plugin. One of the modifications I've made is to add a class that limits the height of the options container and adds a scrollbar when it would otherwise be more than 50% of the height of the closest, relatively positioned parent. But now when I try to click and drag the scrollbar in a container (especially in IE and Chrome) the container disappears as if I clicked it.

Is there a way to detect when the focus is on the scrollbar? Or is there any other plugin modification you could recommend to keep the options from disappearing until selected, or is there really a click event outside of the container?

+3


source to share


2 answers


I ended up solving the problem by adding these lines to the selectbox plugin:



$container
.mousedown(function (e) {
    hasfocus = 1;
})
.mousemove(function (e) {
    hasfocus = 0;
})
.scroll(function (e) {
    $input.focus();
});

      

+1


source


You have a desire to hide the selected checkbox when you click the button outside of the generated ul. Change it to hide when you exit .selectbox-wrapper

.



+1


source







All Articles