Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Content functions are now called every time the tooltip is toggled (s…
Browse files Browse the repository at this point in the history
…hown)
  • Loading branch information
Craga89 committed Apr 22, 2011
1 parent b4e1c1e commit 78c2ff7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
13 changes: 8 additions & 5 deletions dist/jquery.qtip.basic.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Fri Apr 22 20:26:38 2011 +0100
* Date: Fri Apr 22 20:28:01 2011 +0100
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -314,6 +314,7 @@ function QTip(target, options, id, attr)
function updateContent(content, reposition)
{
var elem = elements.content;
content = content || options.content.text;

// Make sure tooltip is rendered and content is defined. If not return
if(!self.rendered || !content) { return FALSE; }
Expand Down Expand Up @@ -673,8 +674,7 @@ function QTip(target, options, id, attr)
{
if(self.rendered) { return self; } // If tooltip has already been rendered, exit

var content = options.content.text,
title = options.content.title.text,
var title = options.content.title.text,
callback = $.Event('tooltiprender');

// Add ARIA attributes to target
Expand Down Expand Up @@ -716,7 +716,7 @@ function QTip(target, options, id, attr)
}

// Set proper rendered flag and update content
updateContent(content);
updateContent();
self.rendered = TRUE;

// Setup widget classes
Expand Down Expand Up @@ -896,7 +896,10 @@ function QTip(target, options, id, attr)
// Focus the tooltip
self.focus(event);

// Update tooltip position
// Update tooltip content if it's a dynamic function
if($.isFunction(options.content.text)) { updateContent(); }

// Update the tooltip position
self.reposition(event);

// Hide other tooltips if tooltip is solo, using it as the context
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.qtip.css
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Fri Apr 22 20:26:38 2011 +0100
* Date: Fri Apr 22 20:28:01 2011 +0100
*/

/* Fluid class for determining actual width in IE */
Expand Down
13 changes: 8 additions & 5 deletions dist/jquery.qtip.js
Expand Up @@ -9,7 +9,7 @@
* http://en.wikipedia.org/wiki/MIT_License
* http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Fri Apr 22 20:26:38 2011 +0100
* Date: Fri Apr 22 20:28:01 2011 +0100
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
Expand Down Expand Up @@ -314,6 +314,7 @@ function QTip(target, options, id, attr)
function updateContent(content, reposition)
{
var elem = elements.content;
content = content || options.content.text;

// Make sure tooltip is rendered and content is defined. If not return
if(!self.rendered || !content) { return FALSE; }
Expand Down Expand Up @@ -673,8 +674,7 @@ function QTip(target, options, id, attr)
{
if(self.rendered) { return self; } // If tooltip has already been rendered, exit

var content = options.content.text,
title = options.content.title.text,
var title = options.content.title.text,
callback = $.Event('tooltiprender');

// Add ARIA attributes to target
Expand Down Expand Up @@ -716,7 +716,7 @@ function QTip(target, options, id, attr)
}

// Set proper rendered flag and update content
updateContent(content);
updateContent();
self.rendered = TRUE;

// Setup widget classes
Expand Down Expand Up @@ -896,7 +896,10 @@ function QTip(target, options, id, attr)
// Focus the tooltip
self.focus(event);

// Update tooltip position
// Update tooltip content if it's a dynamic function
if($.isFunction(options.content.text)) { updateContent(); }

// Update the tooltip position
self.reposition(event);

// Hide other tooltips if tooltip is solo, using it as the context
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/jquery.qtip.pack.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/core.js
Expand Up @@ -272,6 +272,7 @@ function QTip(target, options, id, attr)
function updateContent(content, reposition)
{
var elem = elements.content;
content = content || options.content.text;

// Make sure tooltip is rendered and content is defined. If not return
if(!self.rendered || !content) { return FALSE; }
Expand Down Expand Up @@ -631,8 +632,7 @@ function QTip(target, options, id, attr)
{
if(self.rendered) { return self; } // If tooltip has already been rendered, exit

var content = options.content.text,
title = options.content.title.text,
var title = options.content.title.text,
callback = $.Event('tooltiprender');

// Add ARIA attributes to target
Expand Down Expand Up @@ -674,7 +674,7 @@ function QTip(target, options, id, attr)
}

// Set proper rendered flag and update content
updateContent(content);
updateContent();
self.rendered = TRUE;

// Setup widget classes
Expand Down Expand Up @@ -854,7 +854,10 @@ function QTip(target, options, id, attr)
// Focus the tooltip
self.focus(event);

// Update tooltip position
// Update tooltip content if it's a dynamic function
if($.isFunction(options.content.text)) { updateContent(); }

// Update the tooltip position
self.reposition(event);

// Hide other tooltips if tooltip is solo, using it as the context
Expand Down

0 comments on commit 78c2ff7

Please sign in to comment.