imgSlider icon indicating copy to clipboard operation
imgSlider copied to clipboard

demo doesn't work on my Android 4.2 phone

Open joyously opened this issue 9 years ago • 5 comments

The touch events are having no effect on the slider.

joyously avatar Jan 22 '16 17:01 joyously

@joyously Could you please provide any more details? I'm assuming you are trying it here. It works as expected on all android devices i tested on including

kavyasukumar avatar Jan 25 '16 21:01 kavyasukumar

I've attached a screenshot from my phone. You can see that the instruction text is gone, because I touched the image. But it does not move the bar or change in any other way. I'm using the stock browser on Android 4.2 and javascript is enabled. What other details can I provide? I tried it on my friend's Android 4.4 phone and it worked fine. screenshot_2016-01-25-15-44-30

joyously avatar Jan 25 '16 21:01 joyously

Hi, awesome plugin, I see touch events are enabled, but this is not working with any touch device. Were you able to fix this lately? I'm looking into it myself but I can't detect the issue. Thanks

matt-atl avatar Oct 04 '16 00:10 matt-atl

Replacing

var slideResize = function (e) {
	e.preventDefault();
	//hide instructions
	$(e.currentTarget).children('.instruction').hide();
	var width;
	if(e.type.startsWith('touch')){
		width = e.originalEvent.touches[0].clientX - e.originalEvent.layerX;
	} else {
		width = e.offsetX === undefined ? e.pageX - e.originalEvent.layerX : e.offsetX;
	}
	if (width<=$(this).width()){
		$(this).find('.left.image').css('width', width + 'px');
	}
};

with

var slideResize = function (e) {
	e.preventDefault();
	//hide instructions
	$(e.currentTarget).children('.instruction').hide();
	var width;
	if(e.type.startsWith('touch')){
		width = e.originalEvent.touches[0].clientX - this.offsetLeft;
	} else {
		width = e.offsetX === undefined ? e.pageX - e.originalEvent.layerX : e.offsetX;
	}
	if (width<=$(this).width()){
		$(this).find('.compare_left.compare_image').css('width', width + 'px');
	}
};

should fix the issue on mobile.

MuadAgo avatar Jan 18 '17 18:01 MuadAgo

Thanks!

shreyansb avatar Nov 05 '20 04:11 shreyansb