Hi there,

For our sitemap, I am attempting to create functionality that when a
user hovers over a link, a description is shown in a tooltip, similar
to how a video and it's description show on hover at netflix.com. Our
sitemap has a sister json file, that has the description fields in it.
My thinking is that when you hover over a link, the $.getJSON("") is
invoked and is iterated through, returning the description field for
the item when the link rel tag == the id field in the json file. I am
successfully accessing the json file, but I am trying to integrate
this into the tooltip plugin (http://bassistance.de/jquery-plugins/
jquery-plugin-tooltip/). Here is what I have so far. It is also
possible that there is a much better way to do this, in which case I
am all ears. I'm not really sure if this is even possible with the
tooltip plugin? Thanks!

$('#site-map-list a').tooltip({    /* tooltips for site-map */

                bodyHandler: function() {
                    var ID = $(this).attr('rel');
                    var TEST = "testing";

                    $.getJSON("/sitemap.json", function(data, item){
                        $.each(data.items, function(i,item){
                        if ( item.id == ID ) {
                            console.log("IDs match");
                            TEST =  item.description;
                            }
                        });
                    return TEST;
                    });
               }
        });

Reply via email to