javascript - Twitter bootstrap popover with manual click trigger. Preventing default -


i'm trying figure out how configure multiple twitter bootstrap's popovers manual click.

but first, code:

# bootstrap.js.coffee # opens popover 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'  # handles clicks everywhere on page , decides if 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) , $(this).siblings(".popover").length isnt 0 , $(this).siblings(".popover").has(e.target).length 0 

this popoverable link. have hundreds of these on same page different data-poload attribute:

<a href="#" data-poload="/resources/some-id/popover">text</a> 

my server respond html request /resources/some-id/popover goes in popover body.

what want happen if click popover:

  • open popover (after server responds)
  • don't scroll top of page
  • don't close if click on popover's body (there links there)
  • close previous popover (if opened)

if click anywhere else:

  • close previous popover (if opened)

the problem:

  • if click popover scroll top of page (typical click propagation)
  • if re-click same link open popover, popover broken , not able open again. opens , closes right after.

i tried putting return false so

# 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 

but won't work because next js bit not triggered. 1 that's supposed close other popovers. clicking everywhere else works of course.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -