2
I’m using this library / Plunker:
I would like to make the touch work with the effect:
touch-action: pan-x;
Like this example, if you enable the console, with active mobile version can see the ringtone working.
Em tried to do using javascript:
$(document).on("touchstart",'.carousel-item', function(ts) {
var start_client_x = ts.clientX + parseInt($(this).width());
current_client_x = ts.clientX+ parseInt($(this).width());
if (ts.type == 'touchstart') {
var touch = ts.originalEvent.touches[0] || ts.originalEvent.changedTouches[0];
ts = touch;
// start_page = ts.pageX;
start_client_x = ts.clientX+ parseInt($(this).width());
}
$(document).on("touchmove", '.carousel-item', function (e) {
if(e.type == 'touchmove') {
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
e = touch;
//current_page = e.pageX;
current_client_x = e.clientX+ parseInt($(this).width());
}
console.log('start->'+start_client_x, 'end->'+current_client_x);
// var x_position = e.pageY;
//
if (start_client_x < current_client_x) {
$(this).parent().parent().parent().parent().find('.carousel-next .carousel-btn').trigger('click');
} else if (start_client_x > current_client_x) {
$(this).parent().parent().parent().parent().find('.carousel-prev .carousel-btn').trigger('click');
}
});
});
But it got a little strange the movement.
Try to place this other property in the slider container
-webkit-overflow-scrolling: touch;
and prefix tb in the other properties,touch-action
/-webkit-touch-action
... Try it on and see if it works...– hugocsl
Unfortunately, nothing has changed after this.
– Ivan Ferrer
present your code in the question
– Leandro Angelo