AshBestos AshBestos - 10 months ago 57
jQuery Question

How do I get 'simple tip' jQuery to work on Ajax loaded page?

I'm using the 'simple tip' jQuery tooltip code on my site, which is working as it should on the index page but is not working on external pages I'm loading via AJAX.

Please see the live example here (Removed - no longer live). You will see it is working on the category icons, but not on the 5 images in the box below. Though it works when you load this content independently. (/featured.html)

I've searched here on the subject of using jQuery on AJAX loaded pages and I've seen people mentioning:


but I just don't know how to implement it into the tooltip code, which is as follows:

function simple_tooltip(target_items, name){
$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
var my_tooltip = $("#"+name+i);

if($(this).attr("title") != ""){ // checks if there is a title

my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(50);
my_tooltip.css({left:kmouse.pageX-15, top:kmouse.pageY+30});



Would anyone be kind enough to point me in the right direction?

Thanks in advance!

Answer Source

I guess, binding the simple tooltip again after loading the content using ajax will do the trick