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

Commit

Permalink
Fixed issue with mouse positioning on first show
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed May 23, 2011
1 parent 4c2ae4f commit 3649caf
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 16 deletions.
18 changes: 14 additions & 4 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: Mon May 23 16:36:48 2011 +0100
* Date: Mon May 23 16:40:00 2011 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -1573,15 +1573,25 @@ QTIP.bind = function(opts, event)
events.hide += ' mouseleave' + namespace;
}

/*
* Cache mousemove events on show targets and tooltip for positioning purposes.
* We'll do this here as well as in assignEvents so that it positions properly
* on first show/render.
*/
if(options.position.target === 'mouse') {
targets.show.bind('mousemove'+namespace, function(event) {
MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
});
}

// Define hoverIntent function
function hoverIntent(event) {
function render() {
// Cache mouse coords,render and render the tooltip
api.render(typeof event === 'object' || options.show.ready);

// Unbind show and hide event
targets.show.unbind(events.show);
targets.hide.unbind(events.hide);
// Unbind show and hide events
targets.show.add(targets.hide).unbind(namespace);
}

// Only continue if tooltip isn't disabled
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: Mon May 23 16:36:48 2011 +0100
* Date: Mon May 23 16:40:00 2011 +0100
*/

/* Core qTip styles */
Expand Down
18 changes: 14 additions & 4 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: Mon May 23 16:36:48 2011 +0100
* Date: Mon May 23 16:40:00 2011 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -1573,15 +1573,25 @@ QTIP.bind = function(opts, event)
events.hide += ' mouseleave' + namespace;
}

/*
* Cache mousemove events on show targets and tooltip for positioning purposes.
* We'll do this here as well as in assignEvents so that it positions properly
* on first show/render.
*/
if(options.position.target === 'mouse') {
targets.show.bind('mousemove'+namespace, function(event) {
MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
});
}

// Define hoverIntent function
function hoverIntent(event) {
function render() {
// Cache mouse coords,render and render the tooltip
api.render(typeof event === 'object' || options.show.ready);

// Unbind show and hide event
targets.show.unbind(events.show);
targets.hide.unbind(events.hide);
// Unbind show and hide events
targets.show.add(targets.hide).unbind(namespace);
}

// Only continue if tooltip isn't disabled
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.

16 changes: 13 additions & 3 deletions src/core.js
Expand Up @@ -1533,15 +1533,25 @@ QTIP.bind = function(opts, event)
events.hide += ' mouseleave' + namespace;
}

/*
* Cache mousemove events on show targets and tooltip for positioning purposes.
* We'll do this here as well as in assignEvents so that it positions properly
* on first show/render.
*/
if(options.position.target === 'mouse') {
targets.show.bind('mousemove'+namespace, function(event) {
MOUSE = { pageX: event.pageX, pageY: event.pageY, type: 'mousemove' };
});
}

// Define hoverIntent function
function hoverIntent(event) {
function render() {
// Cache mouse coords,render and render the tooltip
api.render(typeof event === 'object' || options.show.ready);

// Unbind show and hide event
targets.show.unbind(events.show);
targets.hide.unbind(events.hide);
// Unbind show and hide events
targets.show.add(targets.hide).unbind(namespace);
}

// Only continue if tooltip isn't disabled
Expand Down

0 comments on commit 3649caf

Please sign in to comment.