mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
auto-complete: even stick box if site was already scrolled before open #155
This commit is contained in:
parent
b84b4157bc
commit
c4acec0880
1 changed files with 4 additions and 4 deletions
|
@ -78,11 +78,11 @@ var autoComplete = (function(){
|
|||
parentOffsetLeft = parentElement.getBoundingClientRect().left;
|
||||
parentOffsetTop = parentElement.getBoundingClientRect().top;
|
||||
} else {
|
||||
pageXOffset = window.pageXOffset;
|
||||
pageYOffset = window.pageYOffset;
|
||||
pageXOffset = window.pageXOffset || document.documentElement.scrollLeft;
|
||||
pageYOffset = window.pageYOffset || document.documentElement.scrollTop;
|
||||
}
|
||||
that.sc.style.left = Math.round(rect.left + (pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft - parentOffsetLeft) + 'px';
|
||||
that.sc.style.top = Math.round(rect.bottom + (pageYOffset || document.documentElement.scrollTop) + o.offsetTop - parentOffsetTop) + 'px';
|
||||
that.sc.style.left = Math.round(rect.left + pageXOffset + o.offsetLeft - parentOffsetLeft) + 'px';
|
||||
that.sc.style.top = Math.round(rect.bottom + pageYOffset + o.offsetTop - parentOffsetTop) + 'px';
|
||||
that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
|
||||
if (!resize) {
|
||||
that.sc.style.display = 'block';
|
||||
|
|
Loading…
Reference in a new issue