Skip to content

Possible minor easily fixable bug after pjax #219

@andrewblake1

Description

@andrewblake1

Firstly - awesome plugin! Loving it. Its the 3rd infinite scroll plugin I have tried and this is by far the best.

There is possibly one minor issues and easy fix that I have found when using with pjax.

Am using via an extension in the yii2 php framework and filtering/sorting is handled automatically for me. With pjax enabled after sorting.filtering multiple spinner wheels appear when scrolling.

I have fixed for myself easily by adding:

$(document).on('pjax:beforeReplace', function() {
    $.ias().destroy();
});

$(document).on('pjax:end', function() {
    $.ias().reinitialize();
});

however I suspect the cause to be after filtering that a re-initialising of the IAS object probably occurs and is probably chaining another scroll event on top of the existing one.

A fix within this plugin might be to unbind ias events prior to binding so that this couldn't occur?

Note also that I had thought that reinitialize alone would have done the job but suspect the events are left attached.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions