You may know this, but :hover does not exist on touch screen devices. Therefore, when you design a responsive website, you should carefully plan when and where to use it: freezing.
While it is implemented on mobile devices, it is extremely buggy, mainly on iOS devices. On the other end, you cannot use :focus , because it can only be used on elements that support focus, so tags and buttons are excluded. Also :active does not go to mobile devices.
In this case, we can use jQuery to fix this problem.
Working example: http://jsfiddle.net/Gajotres/84Nug/
In this example, I used the events vmousedown , vmouseup and vmousecancel , so I can check it on the desktop / mobile devices. Just replace them with touchstart , touchend and touchcancel .
touchcancel / vmousecancel necessary because sometimes the button can remain pressed.
Code:
$(document).on('pagebeforeshow', '#index', function(){ $(document).on('touchstart','.custom_header' ,function(){ $(".custom_header").css("background","url('http://www.cesarsway.com/sites/default/files/cesarsway-images/features/2012/March/Puppies-and-Exercise.jpg') no-repeat center"); }).on('touchend', function(){ $(".custom_header").css("background","red"); }).on("touchcancel", function() { $(".custom_header").css("background","red"); }); });
source share