0

How come I need to add a touch event to my element for it to enable hover styles? Is this normal? Sure feels a bit wonky

This is what I have to add to make :hover work, if I don't no :hover style is set
sorry for the coffeescript

@button.$el.on('touchstart', ()->
    console.log("touch started")
)
August Bjornberg
  • 4,827
  • 5
  • 18
  • 30

1 Answers1

3

Ok so i took a look at what Roddy of the Frozen Peas linked and found that you could add 'ontouchstart=""' to the element to enable hover styles.

What I realised though, was that it's enough to add it to the super parent, and it will bubble down to all child elements, neat-O!

August Bjornberg
  • 4,827
  • 5
  • 18
  • 30
  • This is the solution. I have been looking for an answer to this problem for an hour. – Philip Apr 15 '13 at 00:53
  • exactly what I needed. Also, don't forget to add on("touchend",function() {...} if you want to clear it. +1 – Lukas Nov 13 '13 at 21:23