fix top and articel list

This commit is contained in:
yi-ge 2020-11-14 14:25:43 +08:00
parent 76de2e555f
commit 1449524d4e
2 changed files with 33 additions and 33 deletions

View File

@ -1327,7 +1327,7 @@ modal
background-color #000
padding 10px
box-shadow 0 0 8px #000
z-index 999
z-index 99999
padding-bottom 20px
min-width 240px
max-width 300px

View File

@ -2,11 +2,11 @@ import '~/layouts/common.styl'
import vditor from 'vditor'
import 'vditor/dist/index.css'
// const $tags = document.getElementById('tags')
// let floatTop = null
// if ($tags) {
// floatTop = $tags.offsetTop + $tags.scrollHeight + 30
// }
const $tags = document.getElementById('tags')
let floatTop = null
if ($tags) {
floatTop = $tags.offsetTop + $tags.scrollHeight + 30
}
function addEvent (obj, type, fn) {
if (obj.attachEvent) {
@ -25,35 +25,35 @@ window.onload = function () {
alert('您的浏览器版本过低,继续访问将会出现问题,请升级浏览器版本!') // eslint-disable-line
}
// // 底部返回顶部按钮
// const top = document.getElementById('gotop')
// if (top) {
// // 滚动一屏幕时显示回到顶部
// addEvent(window, 'scroll', function () {
// const currentPosition = document.documentElement.scrollTop || document.body.scrollTop
// currentPosition > window.screen.availHeight ? top.style.display = 'block' : top.style.display = 'none'
// 底部返回顶部按钮
const top = document.getElementById('gotop')
if (top) {
// 滚动一屏幕时显示回到顶部
addEvent(window, 'scroll', function () {
const currentPosition = document.documentElement.scrollTop || document.body.scrollTop
currentPosition > window.screen.availHeight ? top.style.display = 'block' : top.style.display = 'none'
// // 左部导航自动浮动
// if (currentPosition > floatTop && document.body.clientWidth > 768) {
// document.getElementById('navication').style.position = 'fixed'
// } else {
// document.getElementById('navication').style.position = 'static'
// }
// })
// 左部导航自动浮动
if (currentPosition > floatTop && document.body.clientWidth > 768) {
document.getElementById('navication').style.position = 'fixed'
} else {
document.getElementById('navication').style.position = 'static'
}
})
// top.onclick = function () {
// var timer = setInterval(function () { // eslint-disable-line
// let currentPosition = document.documentElement.scrollTop || document.body.scrollTop
// currentPosition -= 100
// if (currentPosition > 0) {
// window.scrollTo(0, currentPosition)
// } else {
// window.scrollTo(0, 0)
// clearInterval(timer)
// }
// }, 10)
// }
// }
top.onclick = function () {
var timer = setInterval(function () { // eslint-disable-line
let currentPosition = document.documentElement.scrollTop || document.body.scrollTop
currentPosition -= 100
if (currentPosition > 0) {
window.scrollTo(0, currentPosition)
} else {
window.scrollTo(0, 0)
clearInterval(timer)
}
}, 10)
}
}
let _hmt = _hmt || [] // eslint-disable-line
const hm = document.createElement('script')