Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:35:12+00:00 2026-06-17T09:35:12+00:00

I’ve got some popovers which I’d like to trigger ‘on hover’ of some elements

  • 0

I’ve got some popovers which I’d like to trigger ‘on hover’ of some elements of a raphael.js graphic, but I can’t seem to get them to work (using jQuery UI and Bootstrap).

I’m calling popovers on the site by referencing a specified class:

$(document).ready(function() {
  $('.show-popover').popover();
});

Then I can trigger popovers by adding the relevant attributes to an HTML tag: class="show-popover", rel="popover", data-trigger="hover", etc.

I’ve also got some embedded raphael.js SVG graphics on the site. I can’t seem to get the popovers to appear for elements (paths, text, etc.) of the raphael.js graphic after I’ve added the same attributes mentioned above.

Say I add a square to my graphic; I can then add the required popover attributes to the square in raphael.js like so:

square.node.setAttribute('class', 'show-popover');
square.node.setAttribute('rel', 'popover');
square.node.setAttribute('data-trigger', 'hover');
square.node.setAttribute('data-original-title', 'Popover title');
square.node.setAttribute('data-content', 'Main popover text here...');

I can see that the attributes are being added to the SVG with Firebug, but the popover isn’t appearing on hover.

Is it possible to trigger popovers for hovering over elements of a raphael.js graphic?

[Edit] See example http://jsfiddle.net/cQGQT/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:35:13+00:00Added an answer on June 17, 2026 at 9:35 am

    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 div tags are not renderable inside an SVG node, nothing shows up. To get around this, I appended a div to the body to act as a holder for the popover, and positioned and toggled it via the DOM mouse events for circle SVG elements.

    Here is the idea:

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

    and the full fiddle:
    http://jsfiddle.net/BzJCq/2/

    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.

    [EDIT – to address swapping title/content]

    If you want to swap the content of the popover based on the which node is triggering it, you can do something like:

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

    And then in the triggering logic, update the pop-over element’s data attributes like so:

    // ph is the element holding the popover
    ph.attr('data-original-title', targ.attr('pop-title'));
    ph.attr('data-content', targ.attr('pop-content'));
    

    I updated my fiddle link above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.