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

Live to on #144

Open
wants to merge 3 commits 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
13 changes: 11 additions & 2 deletions src/javascripts/jquery.tipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
if (ele == document) return true;
}
return false;
};
}

function jQueryDelegateEventMethod() {
var majorVersionNumber = parseFloat($().jquery);
if (majorVersionNumber >= 1.7) {
return 'on';
} else {
return 'live';
}
}

function Tipsy(element, options) {
this.$element = $(element);
Expand Down Expand Up @@ -174,7 +183,7 @@
if (!options.live) this.each(function() { get(this); });

if (options.trigger != 'manual') {
var binder = options.live ? 'live' : 'bind',
var binder = options.live ? jQueryDelegateEventMethod() : 'bind',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace jQueryDelegateEventMethod() with ('on' in this ? 'on' : 'live')

eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
this[binder](eventIn, enter)[binder](eventOut, leave);
Expand Down