Skip to content

Commit

Permalink
fix(popup): support iOS to recognize popup close on touch
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de authored and Sean committed Apr 8, 2019
1 parent 5745cf7 commit c978917
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ $.fn.popup = function(parameters) {

moduleSelector = $allModules.selector || '',

clickEvent = ('ontouchstart' in document.documentElement)
? 'touchstart'
: 'click',

time = new Date().getTime(),
performance = [],

Expand Down Expand Up @@ -981,7 +985,7 @@ $.fn.popup = function(parameters) {
module.debug('Binding popup events to module');
if(settings.on == 'click') {
$module
.on('click' + eventNamespace, module.toggle)
.on(clickEvent + eventNamespace, module.toggle)
;
}
if(settings.on == 'hover') {
Expand Down Expand Up @@ -1038,7 +1042,7 @@ $.fn.popup = function(parameters) {
clickaway: function() {
module.verbose('Binding popup close event to document');
$document
.on('click' + elementNamespace, function(event) {
.on(clickEvent + elementNamespace, function(event) {
module.verbose('Clicked away from popup');
module.event.hideGracefully.call(element, event);
})
Expand Down

0 comments on commit c978917

Please sign in to comment.