Skip to content

Commit a2595fc

Browse files
committed
Handle variable height start index.
1 parent a85182c commit a2595fc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function (root, factory) {
1+
;(function (root, factory) {
22
var namespace = 'VirtualScrollList'
33
if (typeof exports === 'object' && typeof module === 'object') {
44
module.exports = factory(namespace, require('vue'))
@@ -90,8 +90,8 @@
9090

9191
var delta = this.delta
9292
var start, end, scrollTop
93-
94-
if (this.isOverflow(index)) {
93+
var isOver = this.isOverflow(index)
94+
if (isOver) {
9595
var zone = this.getLastZone()
9696
end = zone.end
9797
start = zone.start
@@ -102,6 +102,10 @@
102102
scrollTop = start * this.size
103103
}
104104

105+
if (this.variable) {
106+
scrollTop = this.getVarOffset(isOver ? delta.total : start)
107+
}
108+
105109
delta.end = end
106110
delta.start = start >= this.remain ? start : 0
107111

0 commit comments

Comments
 (0)