Livewire actions not firing on content loaded via jscroll

I’m using jscroll to load new pagination items dynamically:

require('jscroll');

$('ul.pagination').hide();
$('.infinite-scroll').jscroll({
    autoTrigger: true,
    padding: 0,
    loadingHtml: '<i class="fas fa-spinner fa-spin text-secondary"></i>',
    nextSelector: '.pagination li.active + li a',
    contentSelector: 'div.infinite-scroll',
    callback: function() {
        $('ul.pagination').remove();
    }
});

The problem is that wire:click etc. on the content loaded via jscroll doesn’t fire. How do I get livewire to attach action listeners on the jscroll callback?

Hey @redbastie,

have a look at this thread: [SOLVED] Livewire child components loaded by Jquery Ajax not working

You can tell Livewire to initialize new components by calling “window.livewire.rescan()” atfer they have been appended to the DOM.

1 Like