Skip to content

Commit 79febf6

Browse files
committed
another shot on #8
1 parent c735a2a commit 79febf6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ui-scroll.coffee

+5-4
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,15 @@ angular.module('ui.scroll', [])
309309
# We need the item bindings to be processed before we can do adjustment
310310
$timeout ->
311311

312+
if toBePrepended.length
313+
bottomPos = buffer[buffer.length-1].element.offset().top;
314+
312315
for wrapper in toBePrepended
313316
builder.insertElement wrapper.element
314-
prepFirst = prepFirst || wrapper.element # element prepended first
315-
prepLast = wrapper.element # element prepended last
316317
wrapper.op = 'none'
317318

318-
if prepFirst
319-
heightIncrement = prepFirst.next().offset().top - prepLast.offset().top
319+
if toBePrepended.length
320+
heightIncrement = buffer[buffer.length-1].element.offset().top - bottomPos
320321
# adjust padding to prevent it from visually pushing everything down
321322
if builder.topPadding() >= heightIncrement
322323
# if possible, reduce topPadding

0 commit comments

Comments
 (0)