Javascript 带有手动点击触发器的Twitter引导弹出窗口。防止违约
我试图弄清楚如何通过手动点击来配置多个twitter引导的弹出窗口 但首先,一些代码:Javascript 带有手动点击触发器的Twitter引导弹出窗口。防止违约,javascript,twitter-bootstrap,popover,Javascript,Twitter Bootstrap,Popover,我试图弄清楚如何通过手动点击来配置多个twitter引导的弹出窗口 但首先,一些代码: # bootstrap.js.coffee # this opens a popover with new server data $('*[data-poload]').bind 'click', -> $this = $(this) $.get $this.data('poload'), (d) -> $this.popover content: d h
# bootstrap.js.coffee
# this opens a popover with new server data
$('*[data-poload]').bind 'click', ->
$this = $(this)
$.get $this.data('poload'), (d) ->
$this.popover
content: d
html: true
title: $this.parents("tr").data("title")
.popover 'show'
# this handles clicks everywhere on the page and decides what to do if it finds opened popovers
$("html").click (e) ->
$('*[data-poload]').each ->
$(this).popover "hide" if not ($(this).is(e.target) or $(this).has(e.target).length > 0) and $(this).siblings(".popover").length isnt 0 and $(this).siblings(".popover").has(e.target).length is 0
这是popoverable链接。我在同一页面上有数百个具有不同数据poload属性的:
<a href="#" data-poload="/resources/some-id/popover">Text</a>
但这不会起作用,因为下一个js位不会被触发。应该关闭其他爆米花的那个。点击其他任何地方都有效
当然
# bootstrap.js.coffee
$('*[data-poload]').bind 'click', ->
$this = $(this)
$.get $this.data('poload'), (d) ->
$this.popover
content: d
html: true
title: $this.parents("tr").data("title")
.popover 'show'
false