Browse Source

make popover close when click anyway

pull/585/head
Darren Liew 11 years ago
parent
commit
53d36a6756
  1. 19
      js/popovers.js

19
js/popovers.js

@ -29,16 +29,18 @@
popover.removeEventListener('webkitTransitionEnd', onPopoverHidden);
};
var hide = function(){
popover.addEventListener('webkitTransitionEnd', onPopoverHidden);
popover.classList.remove('visible');
popover.parentNode.removeChild(backdrop);
});
var backdrop = (function () {
var element = document.createElement('div');
element.classList.add('backdrop');
element.addEventListener('touchend', function () {
popover.addEventListener('webkitTransitionEnd', onPopoverHidden);
popover.classList.remove('visible');
popover.parentNode.removeChild(backdrop);
});
element.addEventListener('touchend', hide());
return element;
}());
@ -69,9 +71,14 @@
};
var showHidePopover = function (e) {
var popover = getPopover(e);
var oldPopover = popover;
popover = getPopover(e);
if (!popover) {
if (oldPopover && oldPopover.hasClass('visible')){
popover = oldPopover;
hide();
}
return;
}

Loading…
Cancel
Save