Search code examples
jquerymodel-view-controllerbackbone.jsmarionette

Multiple jquery events in Marionette ItemView (hover not working)


How can I fire mutiple jquery events in the same line in Marionette ItemView?

Eg. If I want to have the same code for click and hover events. I want to do something like -
events: { "click, hover .class1": "doSomething" // Other events }

1. Code above is obviously wrong, how can I make it right?
2. Also, hover doesn't work at all in Marionette ItemView events, on the other hand, click works fine when used individually. Is that a marionette issue?


Solution

  • You could just split them up:

    events: { 
      "click .class1": "doSomething",
      "hover .class1": "doSomething"
    }
    

    hover will not work however, since jquery dropped the support for that in version 1.9.