1
我目前正试图仅在悬停元素上触发Bootstrap弹出窗口。不幸的是,它触发了页面上的所有内容。下面是骨干脚本(在CoffeeScript中):在所有元素上触发的主干事件侦听器
Site.Views.Stories ||= {}
class Site.Views.Stories.IndexView extends Backbone.View
template: JST["backbone/templates/stories/index"]
initialize:() ->
@options.stories.bind('reset', @addAll)
addAll:() =>
@options.stories.each(@addOne)
addOne: (story) =>
view = new Site.Views.Stories.StoryView({model : story})
@$("#columns").append(view.render().el)
render: =>
$(@el).html(@template(stories: @options.stories.toJSON()));
@addAll()
return this
events: =>
"mouseover .rating" : this.showhover
showhover: =>
this.$('.rating').popover('show');