Closed (fixed)
Project:
Flag
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2012 at 00:24 UTC
Updated:
4 Sep 2013 at 07:11 UTC
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).
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
Comment #1
walker2238 commentedComment #2
walker2238 commentedAnyone?
Comment #3
ariedels commentedtrying 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!
Comment #4
joachim commentedClosing support requests older than a year. Feel free to reopen if this is still relevant.
Comment #5.0
(not verified) commentedSwitched from Beautytips to Qtip2