soundasleep / jquery-dropdown

Bootstrap-style dropdowns with some added features and no dependencies.
Other
767 stars 268 forks source link

Close dropdown on touch devices #62

Closed RhysyG closed 10 years ago

RhysyG commented 10 years ago

Hi there,

Great plugin!

Just a little question, what would be involved if I wanted to add the functionality of closing the dropdown (once opened) by clicking anywhere outside the dropdown? It works with a mouse click, just not a "touch" click.

Thanks.

claviska commented 10 years ago

You could do that with the touchstart or touchend event. Watch for it on the document and make sure the target element isn't the dropdown.

On Jul 8, 2014, at 2:22 AM, RhysyG notifications@github.com wrote:

Hi there,

Great plugin!

Just a little question, what would be involved if I wanted to add the functionality of closing the dropdown (once opened) by clicking anywhere outside the elements? It works with a mouse click, just not a "touch" click.

Thanks.

— Reply to this email directly or view it on GitHub.

RhysyG commented 10 years ago

Awesome, worked perfectly!

Thanks mate.