Skip to content

Commit 8025c64

Browse files
author
SimonSteinberger
committed
Optimized code.
1 parent 9921194 commit 8025c64

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

auto-complete.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,10 @@ var autoComplete = (function(){
6363
that.last_val = '';
6464

6565
that.updateSC = function(resize, next){
66-
var rect = that.getBoundingClientRect(),
67-
scrollTop = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop,
68-
scrollLeft = (document.documentElement && document.documentElement.scrollLeft) || document.body.scrollLeft;
69-
that.sc.style.left = rect.left + scrollLeft + 'px';
70-
that.sc.style.top = rect.bottom + scrollTop + 1 + 'px';
66+
var rect = that.getBoundingClientRect();
67+
that.sc.style.left = rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + 'px';
68+
that.sc.style.top = rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + 1 + 'px';
7169
that.sc.style.width = rect.right - rect.left + 'px'; // outerWidth
72-
7370
if (!resize) {
7471
that.sc.style.display = 'block';
7572
if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }

auto-complete.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)