-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile touch events like Photoswipe #25
Comments
+1 |
+1 ;) |
+1 |
3 similar comments
+1 |
+1 |
+1 |
This new plugin might give some inspiration on how to add mobile touch events: |
+1 |
Am I right that this issue is the cause for the fact that Chocolat is almost not usable on small mobile devices because there is no way to move the image when zoomed? |
@xrat This and that you cannot swipe gesture to the next slide easily. |
+1 |
More informations regarding swipe, and how it can be done : |
I can't use this otherwise very cool plugin because of this :( |
+1 |
This is my piece of code inspired by the comments: $(document).ready(function () {
$('.chocolat-parent').Chocolat({
imageSize: 'contain',
loop: true,
enableZoom: false,
afterImageLoad: function () {
const chocolat = this;
const hammertime = new Hammer(this.elems.img[0], {});
hammertime.on('pan', function (ev) {
if (ev.isFinal) {
// FIXME needs proper API for calling the zoom function (does not work properly)
chocolat.zoomOut();
if (ev.additionalEvent === 'panleft') {
chocolat.api().prev();
} else if (ev.additionalEvent === 'panright') {
chocolat.api().next();
}
}
});
hammertime.on('doubletap', function (ev) {
if (ev.isFinal) {
// FIXME needs proper API for calling the zoom function (does not work properly)
chocolat.zoomIn({pageX: ev.center.x, pageY: ev.center.y});
}
});
}
});
}); The only part missing is the Zoom implementation. It seems the API does not have zoom exposed and this implementation does not work. Suggestions? Agree with @nicolas-t to not implement zoom because it is easy to implement with the library os choice. |
@johansmitsnl At this line : Something like : zoomIn: function(e) {
return that.zoomIn(e)
},
zoomOut: function(duration) {
return that.zoomOut(duration)
}, Then you would have to call it like this : hammertime.on('doubletap', function (ev) {
if (ev.isFinal) {
chocolat.api().zoomIn(ev.srcEvent); // pass source event ev.srcEvent
}
}); |
Love the plug-in but could really use some of the touch event capability similar to Photoswipe. Any thoughts on integrating something like this? Has it been done with any examples? Thank you!
The text was updated successfully, but these errors were encountered: