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');