I am not sure how to structure the following. This works great:
$('.hover li').on 'hover', (ev) ->
$(this).addClass('active')
I know that I can use "toggle" instead of "addClass", but for other reasons I need a passed handler function. So I tried this:
$('.element').on 'hover', (ev)
-> $(this).addClass('active'),
-> $(this).removeClass('active')
This returns an error - "unexpectedly." I tried other options, and most of the examples I found on the Internet do not use the format .on 'hover' (ev) ->.
source
share