mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 09:43:06 +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;
|
parentOffsetLeft = parentElement.getBoundingClientRect().left;
|
||||||
parentOffsetTop = parentElement.getBoundingClientRect().top;
|
parentOffsetTop = parentElement.getBoundingClientRect().top;
|
||||||
} else {
|
} else {
|
||||||
pageXOffset = window.pageXOffset;
|
pageXOffset = window.pageXOffset || document.documentElement.scrollLeft;
|
||||||
pageYOffset = window.pageYOffset;
|
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.left = Math.round(rect.left + pageXOffset + o.offsetLeft - parentOffsetLeft) + 'px';
|
||||||
that.sc.style.top = Math.round(rect.bottom + (pageYOffset || document.documentElement.scrollTop) + o.offsetTop - parentOffsetTop) + '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
|
that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
|
||||||
if (!resize) {
|
if (!resize) {
|
||||||
that.sc.style.display = 'block';
|
that.sc.style.display = 'block';
|
||||||
|
|
Loading…
Reference in a new issue