Skip to content

Commit

Permalink
fix bug: error offset to IE
Browse files Browse the repository at this point in the history
  • Loading branch information
ichord committed Aug 22, 2013
1 parent 32f4f0f commit 61bbc60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions dist/js/jquery.atwho.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,18 @@
};

Caret.prototype.getIEOffset = function(pos) {
var h, range, x, y;
var h, range, textRange, x, y;

range = this.domInputor.createTextRange();
textRange = this.domInputor.createTextRange();
if (pos) {
range.move('character', pos);
textRange.move('character', pos);
} else {
range = document.selection.createRange();
textRange.moveToBookmark(range.getBookmark());
}
x = range.boundingLeft + $inputor.scrollLeft();
y = range.boundingTop + $(window).scrollTop() + $inputor.scrollTop();
h = range.boundingHeight;
x = textRange.boundingLeft + this.$inputor.scrollLeft();
y = textRange.boundingTop + $(window).scrollTop() + this.$inputor.scrollTop();
h = textRange.boundingHeight;
return {
left: x,
top: y,
Expand Down
Loading

0 comments on commit 61bbc60

Please sign in to comment.