infinite scroll

This commit is contained in:
Benjamin Takats
2023-01-24 22:21:52 +01:00
parent 1884b36942
commit eada5424c3
2 changed files with 67 additions and 55 deletions

View File

@@ -122,6 +122,28 @@
</div>
@endforeach
<div
x-data="{
observe () {
let observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
@this.call('loadMore')
}
})
}, {
root: null
})
observer.observe(this.$el)
}
}"
x-init="observe"
></div>
@if($libraryItems->hasMorePages())
<x-button outline wire:click.prevent="loadMore">{{ __('load more...') }}</x-button>
@endif
</div>
</div>