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

Commit

Permalink
Fix tip height/width consistency when changing tooltip position
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Apr 26, 2012
1 parent 7f13a0a commit 970cfab
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 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: Thu Apr 26 20:39:24 2012 +0100
* Date: Thu Apr 26 20:40:09 2012 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
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: Thu Apr 26 20:39:24 2012 +0100
* Date: Thu Apr 26 20:40:09 2012 +0100
*/

/* Core qTip styles */
Expand Down
23 changes: 22 additions & 1 deletion 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: Thu Apr 26 20:39:24 2012 +0100
* Date: Thu Apr 26 20:40:09 2012 +0100
*/

/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
Expand Down Expand Up @@ -2785,6 +2785,17 @@ function Tip(qTip, command)
}
};

function swapDimensions() {
var temp = size.width;
size.width = size.height;
size.height = temp;
}

function resetDimensions() {
size.width = opts.width;
size.height = opts.height;
}

function reposition(event, api, pos, viewport) {
if(!elems.tip) { return; }

Expand Down Expand Up @@ -3083,6 +3094,16 @@ function Tip(qTip, command)
}
precedance = mimic.precedance;

// Ensure the tip width.height are relative to the tip position
if(corner.precedance === 'x') { swapDimensions(); }
else { resetDimensions(); }

// Set the tip dimensions
elems.tip.css({
width: (width = size.width),
height: (height = size.height)
});

// Update our colours
self.detectColours(corner);

Expand Down
6 changes: 3 additions & 3 deletions dist/jquery.qtip.min.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions src/tips/tips.js
Expand Up @@ -75,6 +75,17 @@ function Tip(qTip, command)
}
};

function swapDimensions() {
var temp = size.width;
size.width = size.height;
size.height = temp;
}

function resetDimensions() {
size.width = opts.width;
size.height = opts.height;
}

function reposition(event, api, pos, viewport) {
if(!elems.tip) { return; }

Expand Down Expand Up @@ -373,6 +384,16 @@ function Tip(qTip, command)
}
precedance = mimic.precedance;

// Ensure the tip width.height are relative to the tip position
if(corner.precedance === 'x') { swapDimensions(); }
else { resetDimensions(); }

// Set the tip dimensions
elems.tip.css({
width: (width = size.width),
height: (height = size.height)
});

// Update our colours
self.detectColours(corner);

Expand Down

0 comments on commit 970cfab

Please sign in to comment.