Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can I create tooltips via js after page loads?

I'm thinking of something like this: api.reftagger.com/v2/RefTagger.js, which inserts tooltip Bible snippets based on verse references on a page.

I'd like to be able to load a dynamic page, then run a script to insert tipped links based on a regexp (as in the example linked above), or based on a db glossary. I think the latter would be more universally useful. Anyone have any experience/success with anything like that?

Comments

  • edited December 2015
    A tooltip would need an element to attach itself to, if you're able to create these elements based on a regex pattern as you mentioned, you can use those elements when creating a tooltip with Tipped. I expect the example script to have this same logic, it only uses a different tooltip.

    If you use event delegation through Tipped.delegate it could be as simple as something like this:
    $(document).ready(function() {
    Tipped.delegate("span.has-bible-tooltip[title]");
    });
    At least for the tooltip part, Tipped will automatically pick up on items you'll insert later on.
  • Found this: https://github.com/PebbleRoad/glossarizer, and it plays nicely with 3rd party tooltips. :-)
  • edited December 2015
    Hey Nick,

    Does the Pro version have a way to extract a variable from an html tag and pass that through to Ajax?
    Ra
  • Is this it? data-tipped-options="ajax: { data: { field: 'value' }}"

    If so, I just have to get the glossary script to insert this tag and its value from a json file and I'm good to go ... I think ...
Sign In or Register to comment.