调整滑动吸顶

This commit is contained in:
lmj
2022-10-09 19:55:21 +08:00
parent 3cd643bf2c
commit bf18dfd807
5 changed files with 14 additions and 7 deletions

View File

@@ -263,8 +263,10 @@ export default {
this.dialogVisible = true;
},
handleScroll(){
let innerw = document.querySelector("#qa-fixd");
let innerHeight = document.querySelector('#qa-list-content').clientHeight
let outerHeight = document.documentElement.clientHeight
let outerWidth = innerw.clientWidth;
let scrollTop = document.documentElement.scrollTop
if ((outerHeight + scrollTop + 350) >= innerHeight) {
if(this.moreState == 1) {
@@ -272,7 +274,7 @@ export default {
}
}
if(scrollTop > 400) {
document.querySelector('#qa-fixd').style.cssText = "position: fixed;top: 0px;width:410px;";
document.querySelector('#qa-fixd').style.cssText = "position: fixed;top: 0px;width:"+outerWidth+"px";
} else {
document.querySelector('#qa-fixd').style.cssText = "position: static";
}