diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index a8b242204..92ab688ca 100755 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -67,7 +67,6 @@ $.fn.dropdown = function(parameters) { if(hasTouch) { module.bind.touchEvents(); } - // no use detecting mouse events because touch devices emulate them module.bind.mouseEvents(); module.instantiate(); }, @@ -146,6 +145,7 @@ $.fn.dropdown = function(parameters) { if(hasTouch) { $document .off('touchstart' + eventNamespace) + .off('touchmove' + eventNamespace) ; } $document @@ -216,11 +216,19 @@ $.fn.dropdown = function(parameters) { : $choice.text(), value = ( $choice.data(metadata.value) !== undefined) ? $choice.data(metadata.value) - : text.toLowerCase() + : text.toLowerCase(), + callback = function() { + module.determine.selectAction(text, value); + $.proxy(settings.onChange, element)(value, text); + } ; if( $choice.find(selector.menu).size() === 0 ) { - module.determine.selectAction(text, value); - $.proxy(settings.onChange, element)(value, text); + if(event.type == 'touchstart') { + $choice.one('click', callback); + } + else { + callback(); + } } } @@ -546,12 +554,14 @@ $.fn.dropdown = function(parameters) { if(module.is.visible($currentMenu) ) { module.verbose('Doing menu hide animation', $currentMenu); if($.fn.transition !== undefined && $module.transition('is supported')) { - $currentMenu.transition({ - animation : settings.transition + ' out', - duration : settings.duration, - complete : callback, - queue : false - }); + $currentMenu + .transition({ + animation : settings.transition + ' out', + duration : settings.duration, + complete : callback, + queue : false + }) + ; } else if(settings.transition == 'none') { callback();