Skip to content

Commit dac6cc4

Browse files
committed
fix: scroll
1 parent f265627 commit dac6cc4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/components/pic_tools/ToolGroup.vue

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import ToolButton from 'components/pic_tools/ToolButton'
1212
import {mapState} from 'vuex'
1313
14-
const scrollDistance = window.innerHeight
15-
// const scrollDistance = window.innerHeight * 3 / 4
1614
const keymap = {
1715
scrollUp: ['w','ArrowUp'],
1816
scrollDown: ['s', 'ArrowDown'],
@@ -136,13 +134,20 @@ export default {
136134
this.$log.debug('setting')
137135
this.$bus.emit('btn_click_setting')
138136
},
137+
scroll: function () {
138+
return document.querySelector("#waterfall_page")
139+
},
140+
scrollDistance: function () {
141+
return this.scroll().clientHeight
142+
// return this.scroll().clientHeight * 3 / 4
143+
},
139144
scrollUp(event) {
140145
event.preventDefault()
141-
window.scrollBy({ top: -scrollDistance, behavior: 'smooth' })
146+
this.scroll().scrollBy({ top: -this.scrollDistance(), behavior: 'smooth' })
142147
},
143148
scrollDown(event) {
144149
event.preventDefault()
145-
window.scrollBy({ top: scrollDistance, behavior: 'smooth' })
150+
this.scroll().scrollBy({ top: this.scrollDistance(), behavior: 'smooth' })
146151
},
147152
shortcut: function(event) {
148153
if (!this.image_shortcut) {

src/components/waterfall/PicWaterfall.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<q-page class="full-height-width">
2+
<q-page id="waterfall_page" class="full-height-width" style="height: 95vh; overflow-y: auto;">
33

44
<vue-waterfall ref="waterfall"
55
:gutter="8" :lazyload="true" :delay="400"
@@ -294,7 +294,7 @@ export default {
294294
btn_click_goto_top() {
295295
this.$log.debug('waterfall', this.$refs.waterfall.$el)
296296
// debugger
297-
document.querySelector('html').scrollTop = 0
297+
document.querySelector("#waterfall_page").scrollTop = 0
298298
},
299299
btn_click_loadMore() {
300300
this.$store.dispatch(`${this.storeName}/auto_next`, true)

0 commit comments

Comments
 (0)