Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
fix bug with IE8 getBoundingClientRect.width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Koo committed Jul 14, 2013
1 parent e88ab97 commit c826961
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions js/hopscotch-0.1.0.js
Expand Up @@ -618,7 +618,7 @@
else if (step.placement === 'top' || step.placement === 'bottom') {
arrowEl.style.top = '';
if (arrowOffset === 'center') {
arrowEl.style.left = bubbleWidth/2 + bubblePadding - arrowEl.getBoundingClientRect().width/2 + 'px';
arrowEl.style.left = bubbleWidth/2 + bubblePadding - arrowEl.offsetWidth/2 + 'px';
}
else {
// Numeric pixel value
Expand All @@ -629,7 +629,7 @@
arrowEl.style.left = '';
if (arrowOffset === 'center') {
bubbleHeight = bubbleHeight || el.offsetHeight;
arrowEl.style.top = bubbleHeight/2 + bubblePadding - arrowEl.getBoundingClientRect().height/2 + 'px';
arrowEl.style.top = bubbleHeight/2 + bubblePadding - arrowEl.offsetHeight/2 + 'px';
}
else {
// Numeric pixel value
Expand All @@ -639,15 +639,15 @@

// HORIZONTAL OFFSET
if (step.xOffset === 'center') {
left = (boundingRect.left + boundingRect.width/2) - (bubbleWidth/2) - bubblePadding;
left = (boundingRect.left + targetEl.offsetWidth/2) - (bubbleWidth/2) - bubblePadding;
}
else {
left += utils.getPixelValue(step.xOffset);
}
// VERTICAL OFFSET
if (step.yOffset === 'center') {
bubbleHeight = bubbleHeight || el.offsetHeight;
top = (boundingRect.top + boundingRect.height/2) - (bubbleHeight/2) - bubblePadding;
top = (boundingRect.top + targetEl.offsetHeight/2) - (bubbleHeight/2) - bubblePadding;
}
else {
top += utils.getPixelValue(step.yOffset);
Expand Down

0 comments on commit c826961

Please sign in to comment.