Open lfyfly opened 5 years ago
if you want to use pswp on mobile , see the photoswipe.js in https://github.com/luoyang125024608/vue-photoswipe-mobile repo
find photoswipe/dist/photoswipe-ui-default.js and copy it, overwrite bindEvents
// bind events for UI
_listen('bindEvents', function() {
let st;
let canTap = true;
framework.bind(_controls, 'pswpTap click', _onControlsTap);
framework.bind(pswp.scrollWrap, 'touchstart', () => {
st = +new Date();
});
framework.bind(pswp.scrollWrap, 'touchend', () => {
canTap = +new Date() - st < 200;
});
framework.bind(pswp.scrollWrap, 'touchcancel', () => {
canTap = +new Date() - st < 200;
});
framework.bind(pswp.scrollWrap, 'pswpTap', (...args) => {
canTap && ui.onGlobalTap(...args);
});
if (!pswp.likelyTouchDevice) {
framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);
}
});