Browse Source

Dropdown: Fixes #498, dropdown item links not clickable from touch events. Fixes issue with touchmove event not being cremoved after menu hide

pull/524/head
jlukic 11 years ago
parent
commit
ab1cf3520a
1 changed files with 20 additions and 10 deletions
  1. 30
      src/modules/dropdown.js

30
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();

Loading…
Cancel
Save