Skip to content

Commit

Permalink
fix: correct scroll percent
Browse files Browse the repository at this point in the history
  • Loading branch information
Renovamen committed Feb 4, 2021
1 parent f4e59a8 commit 55793ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/theme-gungnir/components/Common.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div
id="theme-container"
class="theme-container"
:class="pageClasses"
@touchstart="onTouchStart"
Expand Down
8 changes: 4 additions & 4 deletions packages/theme-gungnir/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ export default {
methods: {
handleScroll () {
var currentTop = window.pageYOffset
var docuHeight = document.body.offsetHeight
var windowHeight = document.documentElement.clientHeight
const currentTop = window.pageYOffset
const docuHeight = document.getElementById('theme-container').offsetHeight
const windowHeight = document.documentElement.clientHeight
var percent = currentTop / (docuHeight - windowHeight) * 100
let percent = currentTop / (docuHeight - windowHeight) * 100
if (percent > 100) percent = 100
if (isNaN(percent) || Math.round(percent) <= 0) {
Expand Down

1 comment on commit 55793ed

@vercel
Copy link

@vercel vercel bot commented on 55793ed Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.