How can I add support for mobile devices maybe any jquery swipe or any other way?
Here is my fiddle
Thumbs rotation is working fine the only problem is in mobile devices I have to click to rotate but instead I want to rotate on swipe.
Is there any way to correct my code for both desktop and mobile devices?
Thanks
I have tried with touchstart but it doesn’t work.
jQuery(document).ready(function($) {
var t = null,
r = !1;
$("body").on("mouseenter", ".thumbs", function(e) {
var o = jQuery(this);
if (r = !1, void 0 != o.data("thumbs")) {
var u = o.data("thumbs").split(","),
i = u.length,
a = 1;
t = null, clearTimeout(t), (t = function() {
0 == r && (o.find("img").attr("srcset", u[a]), a <= i && (a == i && (a = 0), setTimeout(t, 500), a++))
})()
}
}).on("mouseleave", ".thumbs", function(e) {
r = !0, t = null;
for (var o = setTimeout(";"), u = 0; u < o; u++) clearTimeout(u);
var i = $(this).find("img"),
a = i.attr("src");
i.attr("srcset", a)
}).on('touchstart', ".thumbs", function(e) {
r = !0, t = null;
for (var o = setTimeout(";"), u = 0; u < o; u++) clearTimeout(u);
var i = $(this).find("img"),
a = i.attr("src");
i.attr("srcset", a)
})
});