1

I'm using this code to make a element enlarge a few pixels when hovered, but for some reason it's blocking touch event (click) on iOS. Any idea?

.hvr-grow {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform;
  transition-property: transform;
}
.hvr-grow:hover {
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
}
Bruno Monteiro
  • 712
  • 6
  • 22

1 Answers1

1

If the problem is on iOS specifically, it may not be the CSS transform event blocking the touch/click event. In iOS Safari, if you want a div to have a click event, it must either have a directly bound onclick handler, or the CSS property cursor: pointer. This is how Safari knows that a div is "clickable", and it's a weird niche of Safari that I don't think exists on other mobile browsers.

See this post for more details: $(document).click() not working correctly on iPhone. jquery

But in short, I'd suggest adding cursor: pointer to .hvr-grow and seeing if that makes a difference. Your :hover CSS won't register on mobile, so you won't get the grow effect anyway.

Community
  • 1
  • 1
daniman
  • 284
  • 1
  • 5
  • That was helpful, but Kyle Horkley comment was the working answer. Thank you thought! http://stackoverflow.com/questions/32612896/css-animations-are-blocking-touch-events-on-ios/32614290#comment53076856_32612896 – Bruno Monteiro Sep 16 '15 at 16:49