I have a web page for mobile (both Android and iOS), and want to make my image button change its color when user tap on it. I have below code:
$("#btn-event-info").bind('touchstart',
function () {
$(this).attr("src","/cms/images/acrActive/option-activity-color.png");
}
).bind('touchend',
function () {
$(this).attr("src","/cms/images/acrActive/option-activity-gray.png");
}
);
But the color changing delays. Since my purpose is to let user know they actually tapped the button, this seems to be meaningless. (Users release their finger soon)
I have read this question 300ms delay removal: using fastclick.js vs using ontouchstart, but when I implement fastclick.js, nothing changes. When I read fastclick's documents, it seems like it does not touch touchstart event but only click event?
Aucun commentaire:
Enregistrer un commentaire