Skip to content

Commit

Permalink
On document scroll, tipsy.show() is called for visible tooltips, so t…
Browse files Browse the repository at this point in the history
…hat their position is updated for elements with fixed position i.e 'position:fixed'
  • Loading branch information
ankit committed Jul 18, 2010
1 parent b66bca9 commit 9066506
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/javascripts/jquery.tipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@
if (tipsy) tipsy[options]();
return this;
}

options = $.extend({}, $.fn.tipsy.defaults, options);

function onDocumentScroll(e) {
e.data.tipsy.show();
}

function get(ele) {
var tipsy = $.data(ele, 'tipsy');
if (!tipsy) {
Expand All @@ -140,9 +143,15 @@
tipsy.hoverState = 'in';
if (options.delayIn == 0) {
tipsy.show();
$(document).bind('scroll', {tipsy:tipsy}, onDocumentScroll);
} else {
tipsy.fixTitle();
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
setTimeout(function() {
if (tipsy.hoverState == 'in') {
tipsy.show();
$(document).bind('scroll', {tipsy:tipsy}, onDocumentScroll);
}
}, options.delayIn);
}
};

Expand All @@ -151,8 +160,14 @@
tipsy.hoverState = 'out';
if (options.delayOut == 0) {
tipsy.hide();
$(document).unbind('scroll', onDocumentScroll);
} else {
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
setTimeout(function() {
if (tipsy.hoverState == 'out') {
tipsy.hide();
$(document).unbind('scroll', onDocumentScroll);
}
}, options.delayOut);
}
};

Expand Down

0 comments on commit 9066506

Please sign in to comment.