mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-04-30 17:31:19 +08:00
auto-complete: even stick box if site was already scrolled before open #155
This commit is contained in:
parent
b84b4157bc
commit
c4acec0880
@ -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…
x
Reference in New Issue
Block a user