News for hackers. Stuff that matters.
Re:Select2 - A better way to make select boxes (with jQuery) by drivebyacct2 on Wednesday June 06, 2012 @11:50PM (#4077519)
It closes when I click outside of it.
Re:Select2 - A better way to make select boxes (with jQuery) by WiseWeasel on Thursday June 07, 2012 @01:10AM (#4077701)
Ah, it does on the computer. On the iPad and iPhone, it does not for some reason.
Re:Select2 - A better way to make select boxes (with jQuery) by taitems on Thursday June 07, 2012 @03:29AM (#4077980)
It's a one line fix, just the developer listening for a mousedown and not a touchstart event.

https://github.com/ivaynberg/select2/issues/77

Re:Select2 - A better way to make select boxes (with jQuery) by WiseWeasel on Thursday June 07, 2012 @04:20AM (#4078062)
Ah, that'll do it. Listening for a click event should work for both, no?
Re:Select2 - A better way to make select boxes (with jQuery) by taitems on Thursday June 07, 2012 @07:42AM (#4078465)
A mouse is not a finger ;)
Re:Select2 - A better way to make select boxes (with jQuery) by WiseWeasel on Thursday June 07, 2012 @10:33AM (#4079176)
True, but they can both generate click events; I've got widgets that listen for clicks and work fine on mobile Safari.
Re:Select2 - A better way to make select boxes (with jQuery) by eyko on Friday June 08, 2012 @06:15AM (#4083553)
A click event would be triggered after the mouseup event, and you to open the dropdown on mousedown event so that you can do all the selection in one click.

I just tried binding .open() to the mousedown event and .close() to the mouseup event and it seems to work for that use case, but it still has to know to behave in the other way (open on mousedown, but don't always close on mouseup).

Re:Select2 - A better way to make select boxes (with jQuery) by WiseWeasel on Friday June 08, 2012 @04:06PM (#4085948)
Oh right... I somehow forgot that pulldown menus can be used as their name implies, by clicking and holding down the mouse to open the menu, and release to make your selection; I've gotten so used to clicking to open, having them stay open, and then clicking again to make my selection (at least since Apple first enabled that feature in System 7). All of a sudden, I'm much less proud of my home-rolled pulldown-menu implementation I've been using.