Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By default, Bootstrap appends the popover element as a sibling of the triggering element. In this case, it is adding the popover as a child of the SVG node. Since <code>div</code> tags are not renderable inside an SVG node, nothing shows up. To get around this, I appended a <code>div</code> to the <code>body</code> to act as a holder for the popover, and positioned and toggled it via the DOM mouse events for <code>circle</code> SVG elements.</p> <p>Here is the idea:</p> <pre><code>// ps is absolutely positioned div in body ph.popover({ trigger: 'manual', title: 'Popover Title', content: 'Popover Content', animation: false }); $('circle').on('mouseover', function(evt){ var targ = $(evt.target), off = targ.offset(), r = parseInt(targ.attr('r')); ph[0].style.left = (off.left + r*2) + 'px'; ph[0].style.top = (off.top + r) + 'px'; ph.popover('show'); }).on('mouseout', function(evt){ ph.popover('hide'); }); </code></pre> <p>and the full fiddle: <a href="http://jsfiddle.net/BzJCq/2/" rel="nofollow">http://jsfiddle.net/BzJCq/2/</a></p> <p>I am not sure that this is the best approach, but I think its the right direction. You can try to use the 'selector' option in the popover settings, but I find it a little trickier to place the popover that way. </p> <p>[EDIT - to address swapping title/content]</p> <p>If you want to swap the content of the popover based on the which node is triggering it, you can do something like:</p> <pre><code>// add different popover data to circles circle.node.setAttribute('pop-title', 'Red Circle'); circle.node.setAttribute('pop-content', 'Content for the red one'); circle2.node.setAttribute('pop-title', 'Green Circle'); circle2.node.setAttribute('pop-content', 'Content for the green one'); </code></pre> <p>And then in the triggering logic, update the pop-over element's data attributes like so:</p> <pre><code>// ph is the element holding the popover ph.attr('data-original-title', targ.attr('pop-title')); ph.attr('data-content', targ.attr('pop-content')); </code></pre> <p>I updated my fiddle link above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload