Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for options object to accept a parent element for the tipsy element to be prepended to #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/javascripts/jquery.tipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo($(this.options.parent));

var pos = $.extend({}, this.$element.offset(), {
var pos = $.extend({}, (this.options.parent != document.body) ? {top: this.$element[0].offsetTop, left: this.$element[0].offsetLeft} : this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
});
Expand Down Expand Up @@ -196,7 +196,8 @@
offset: 0,
opacity: 0.8,
title: 'title',
trigger: 'hover'
trigger: 'hover',
parent: document.body
};

$.fn.tipsy.revalidate = function() {
Expand Down