This works great
@nav.on 'click', ->
_this.mover _this.nav.index $(@)
but I am wondering if I can use a fat arrow instead like this
@nav.on 'click', =>
@mover @nav.index $(????)
but what would I put in place of @
that will result in this
instead of _this
?
jQuery event handlers get an event object as an argument and that event object has target
and currentTarget
properties:
@nav.on 'click', (ev) =>
@mover @nav.index $(ev.currentTarget)
You might want one of the other properties of ev
depending on your specific circumstances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With