diff --git a/grid-n-view.js b/grid-n-view.js index 365984f..f9d0672 100644 --- a/grid-n-view.js +++ b/grid-n-view.js @@ -1021,21 +1021,18 @@ var Gallery = { if(holding_toggle){ holding_toggle = false evt.preventDefault() - hold_timeout - && clearTimeout(hold_timeout) - hold_timeout = undefined - that.toggleToolbar() }} + if(hold_timeout){ + clearTimeout(hold_timeout) + hold_timeout = undefined + that.toggleToolbar() } }} var collapse_button = toolbar.querySelector('.collapse') collapse_button.addEventListener('touchstart', handleInteractionStart) collapse_button.addEventListener('mousedown', handleInteractionStart) - // XXX should these be on document??? - // ...if yes we'll need to be carefull with .preventDefault(..) - document.addEventListener('touchend', handleInteractionEnd) - document.addEventListener('mouseup', handleInteractionEnd) + collapse_button.addEventListener('touchend', handleInteractionEnd) + collapse_button.addEventListener('mouseup', handleInteractionEnd) // toolbar: autohide... var hide_timeout - // XXX does not work correctly with touch... var toolbarAutoHideTimerStart = function(evt){ if(that.toolbar_autohide == 0 || toolbar.classList.contains('sticky')){