|
317 | 317 | } |
318 | 318 |
|
319 | 319 | function bindEvents() { |
320 | | - var options = supports.passiveEvents ? { passive: true } : null; |
| 320 | + var passiveEvent = supports.passiveEvents ? { passive: false } : null; |
| 321 | + var nonPassiveEvent = supports.passiveEvents ? { passive: true } : null; |
| 322 | + |
321 | 323 | bind(overlay, 'click', overlayClickHandler); |
322 | 324 | bind(previousButton, 'click', previousButtonClickHandler); |
323 | 325 | bind(nextButton, 'click', nextButtonClickHandler); |
324 | 326 | bind(closeButton, 'click', closeButtonClickHandler); |
325 | 327 | bind(slider, 'contextmenu', contextmenuHandler); |
326 | | - bind(overlay, 'touchstart', touchstartHandler, options); |
327 | | - bind(overlay, 'touchmove', touchmoveHandler, options); |
| 328 | + bind(overlay, 'touchstart', touchstartHandler, nonPassiveEvent); |
| 329 | + bind(overlay, 'touchmove', touchmoveHandler, passiveEvent); |
328 | 330 | bind(overlay, 'touchend', touchendHandler); |
329 | 331 | bind(document, 'focus', trapFocusInsideOverlay, true); |
330 | 332 | } |
331 | 333 |
|
332 | 334 | function unbindEvents() { |
333 | | - var options = supports.passiveEvents ? { passive: true } : null; |
| 335 | + var passiveEvent = supports.passiveEvents ? { passive: false } : null; |
| 336 | + var nonPassiveEvent = supports.passiveEvents ? { passive: true } : null; |
| 337 | + |
334 | 338 | unbind(overlay, 'click', overlayClickHandler); |
335 | 339 | unbind(previousButton, 'click', previousButtonClickHandler); |
336 | 340 | unbind(nextButton, 'click', nextButtonClickHandler); |
337 | 341 | unbind(closeButton, 'click', closeButtonClickHandler); |
338 | 342 | unbind(slider, 'contextmenu', contextmenuHandler); |
339 | | - unbind(overlay, 'touchstart', touchstartHandler, options); |
340 | | - unbind(overlay, 'touchmove', touchmoveHandler, options); |
| 343 | + unbind(overlay, 'touchstart', touchstartHandler, nonPassiveEvent); |
| 344 | + unbind(overlay, 'touchmove', touchmoveHandler, passiveEvent); |
341 | 345 | unbind(overlay, 'touchend', touchendHandler); |
342 | 346 | unbind(document, 'focus', trapFocusInsideOverlay, true); |
343 | 347 | } |
|
0 commit comments