Skip to content

Instantly share code, notes, and snippets.

@edtoken
Created August 23, 2016 20:44
Show Gist options
  • Save edtoken/ccdf3b9196bf9bb41717fc52c2448e1e to your computer and use it in GitHub Desktop.
Save edtoken/ccdf3b9196bf9bb41717fc52c2448e1e to your computer and use it in GitHub Desktop.
// by Ed
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
setTimeout(function(e){
var timer = false;
function toggle(e){
var target = e.currentTarget;
var $target = $(target).find('.chosen-single');
$target.trigger('mousedown');
}
var start = undefined;
$('.chosen-container').off('touchstart');
$('.chosen-container').on('touchstart', function(e){
start = new Date();
});
$('.chosen-container').on('touchend', function(e){
if(new Date() - start < 250){
var t = e || event;
toggle(t);
start = undefined;
}
});
}, 1500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment