I encounter unwanted behavior when using jQuery $.on("click", function(){}); on touch devices. This is my code below:
Code:
$(".team").on("mouseover", teamMouseOver); $(".team").on("mouseout", teamMouseOut); $(".team").on("click", teamThumbClicked); function teamMouseOver(event){ console.log(event.type); } function teamMouseOut(event){
Problem:
Using the code above, clicking on the .team element on the touch device calls both listeners at the same time, giving me the following console log:
mouseover Clicked!
Question Why mouseover work on a touch device? This is not the behavior that I expect from a device that does not have a mouse. This is mistake? Which event should I use, so that a "mouseover" only fires when it is the actual mouse pointer that enters?
My version of jQuery is 2.2.4.
source share