I've been struggling with this for a while now and figured I'd ask for some help.

I'm using the jquery plugin Qtip2 in which I have a flag (The flag is loaded via ajax).

<?php
Drupal
.behaviors.column = {
attach: function (context, settings) {
// Qtip implimentation
$('a.avatar-thumbnail').each(function() { // Loop over each avatar using the .each() method
  // Get the current users uid.
 
var useruid = Drupal.settings.column.useruid;
  var
authoruid = $(this).attr('rel');
 
// Change the content based on the viewing user.
 
if (useruid != authoruid) {
    var
GetContent = ' .subscribe-wrapper, .subscriber-count';
  }
  else {
    var
GetContent = ' .guest-alert';
  }
 
// Thanks to .each() "this" refers to each element within the loop
 
$(this).qtip({
   
content: {
     
title: {
       
text: '<a href="' + $(this).attr('href') + '">' + $(this).children("img.thumbnail").attr('alt') + '</a>',
      },
     
text: ' ', // Make sure we declare some basic loading content
     
ajax: {
       
url:$(this).attr('href') + GetContent, // Grab user data from serverside PHP script...
        //url: $(this).attr('href') + ' h1, span.flag-subscribe', // Example on how to fetch multiple selectors...
     
}
    },
   
position: {
     
my:'top center', // Position the tooltip...
     
at:'bottom center', // ...to the right of the avatar
     
effect:false,
    },
   
show: {event:'click', solo:true, effect:false, delay:50}, // Give it a reasonable delay so they don't view it accidentally
   
hide: {event:'click unfocus', fixed:true, effect:false, delay:0}, // Allow the user the mouseover the tooltip without it hiding
 
});
});
 
// Change Subscriptions flag text on hover state.
 
$('..subscribe-wrapper a.unflag-action').mouseover(function() {
   
$originalText = $(this).text();
    $(
this).text('Unsubscribe');
  })
  $(
'.subscribe-wrapper a.unflag-action').mouseout(function() {
     $(
this).text($originalText);
  });
}
};
?>

The problem (besides my lack of JS knowledge) is that the flag link javascript isn't being included.... Or at least that's what I believe the problem is.

How can I attach the needed javascript?

Comments

Title:javascript flag not working in beautytipjavascript flag not working in Qtip2

Anyone?

trying to do the same. Issue is that we would need to reattach the flag ajax behaviors to the flag once it is loaded into the qtip object. Calling attachBehaviors after the ajax success would be ideal, but for me it is closing the qtip!

Status:Active» Fixed

Closing support requests older than a year. Feel free to reopen if this is still relevant.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Switched from Beautytips to Qtip2