Navigation Menu

Skip to content

Commit

Permalink
Easier to use ajax for tooltip content
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Cray committed May 13, 2011
1 parent 7e4b448 commit c89ee03
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tooltipsy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 17 additions & 6 deletions tooltipsy.source.js
Expand Up @@ -18,6 +18,7 @@
base.$el = $(el);
base.el = el;
base.random = parseInt(Math.random()*10000);
base.ready = false;
base.shown = false;
base.width = 0;
base.height = 0;
Expand All @@ -26,14 +27,16 @@

base.init = function() {
base.settings = $.extend({},$.tooltipsy.defaults, options);

if (typeof base.settings.content === 'function') {
base.readify();
}

base.$el.bind('mouseenter', function (e) {
if (base.shown == false) {
base.shown = true;
base.title = base.$el.attr('title') || '';
base.$el.attr('title', '');
base.$tipsy = $('<div id="tooltipsy' + base.random + '">').appendTo('body').css({position: 'absolute', zIndex: '999'}).hide();
base.$tip = $('<div class="' + base.settings.className + '">').appendTo(base.$tipsy).html(base.settings.content != '' ? base.settings.content : base.title);
if (base.ready === false) {
base.readify();
}
if (base.shown === false) {
if ((function (o) {
var s = 0, k;
for (k in o) {
Expand Down Expand Up @@ -100,6 +103,14 @@
});
};

base.readify = function () {
base.ready = true;
base.title = base.$el.attr('title') || '';
base.$el.attr('title', '');
base.$tipsy = $('<div id="tooltipsy' + base.random + '">').appendTo('body').css({position: 'absolute', zIndex: '999'}).hide();
base.$tip = $('<div class="' + base.settings.className + '">').appendTo(base.$tipsy).html(base.settings.content != '' ? base.settings.content : base.title);
};

base.init();
};

Expand Down

0 comments on commit c89ee03

Please sign in to comment.