You could use className Bindings by toggling a boolean value when the mouse enters or leaves...
App.AnimalsListView = Ember.CollectionView.extend({
tagName: 'ul',
contentBinding: 'parentView.controller.content',
classNames: ['animals'],
elementId: 'animalsList',
itemViewClass: Ember.View.extend({
isHighlighted: false,
//highlight-name is the CSS Class to be applied when isHighlighted = true
classNameBindings: ['animal', 'isHighlighted:highlight-name'],
template: Ember.Handlebars.compile(
'{{view.content.title}}'
),
mouseEnter: function() {
//due to the following line, class will be applied when mouse enters
this.set('isHighlighted', true);
//this.toggleProperty('isHighlighted'); if using the latest ember
},
mouseLeave: function() {
//remove the class by making the value false when mouse leaves
this.set('isHighlighted', false);
//this.toggleProperty('isHighlighted'); if using the latest ember
}
})
});
Hope this helps...
Update on highlighting an item on click
This method is particularly useful if you are planning on routing on clicking item in a list, and doesn't require clearing the boolean flag by iterating over...
//define a reusable component this way
App.ListView = Ember.CollectionView.extend({
itemViewClass: Ember.View.extend({
tagName: 'li',
classNameBindings: ["isSelected:highlight-item"],
isSelected: (->
return this.get('content.id') === this.get('parentView.selected');
).property('parentView.selected')
})
})
App.PostsController = Ember.ArrayController.extend({
content: [{
name: "name1",
id: 1,
property1: "etc"
},
{
name: "name2",
id: 2,
property1: "etc"
}
]
})
//App.PostsView Handlebars
{{#collection App.ListView contentBinding="content" selectedBinding="controllers.postController.content.id"}}
Name: {{view.content.name}}<br>
Comments: {{view.content.property1}}
{{/collection}}
{{outlet}} //to connect App.PostView
//Now when an item is clicked you could send the context object or just the context id
If you are not using routing you could go with what said by Aras