webcreate / infinite-ajax-scroll

Turn your existing pagination into infinite scrolling pages with ease
https://infiniteajaxscroll.com
Other
899 stars 349 forks source link

Cannot load anything #318

Closed sanastasiou closed 4 years ago

sanastasiou commented 6 years ago

Hi, am trying to use the plugin but I somehow can't manage to load any items.

The script is being used as follows:

the pagination div is updated dynamically, after which I destroy and recreate ias. Here is some example code:

this function is called after pagination is updated:

_createIas: function (){
            if(this._ias){
                this._ias.destroy();
            }
            this._ias = $('#route_list_overflow').ias({
                container: ".route_list_container",
                item: ".item",
                pagination: "#route_list_pagination",
                next: ".next_mini_route a",
                delay: 500
            });
            this._ias.extension(new IASSpinnerExtension());
            this._ias.extension(new IASNoneLeftExtension());
            this._ias.next();
        }
<div id="route_list_overflow" style="max-width: 400px; height: 300px; overflow-y: auto; border: solid 1px red; padding: 1em;">
    <div class="route_list_container">
        <div class="item">
            Item 1.1

            Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
        </div>
        <div class="ias-noneleft" style="text-align: center;" id="ias_noneleft_1528357512771">You reached the end.</div>
        <div class="ias-noneleft" style="text-align: center;" id="ias_noneleft_1528357511761">You reached the end.</div>
        <div class="ias-noneleft" style="text-align: center;" id="ias_noneleft_1528357511593">You reached the end.</div>
        <div class="ias-noneleft" style="text-align: center;" id="ias_noneleft_1528357510752">You reached the end.</div>
    </div>
</div>
<div id="route_list_pagination" class="hidden" style="display: none;">
    <a href="/routes/routes_list/ajax/route_mini_51">1</a>
    <a href="/routes/routes_list/ajax/route_mini_53">2</a>
    <a href="/routes/routes_list/ajax/route_mini_54">3</a>
    <a href="/routes/routes_list/ajax/route_mini_60" class="next_mini_route">4</a>
    <a href="/routes/routes_list/ajax/route_mini_61">5</a>
    <a href="/routes/routes_list/ajax/route_mini_62">6</a>
    <a href="/routes/routes_list/ajax/route_mini_63">7</a>
    <a href="/routes/routes_list/ajax/route_mini_67">8</a>
</div>
fieg commented 6 years ago

Try this:

next: "a.next_mini_route",
sanastasiou commented 6 years ago

Same problem. I don't see any get requests being made from the script at all. I just get several "You reached the end."

sanastasiou commented 6 years ago

Maybe there's something else missing:

item: ".item",

My initial list inside the overflow container looks like this:

<div class="route_list_container">
    <div class="item">
        Item 1.1
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    </div>
    <div class="item">
        Item 1.1
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    </div>
    <div class="item">
        Item 1.1
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    </div>
</div>

Do I need to have declared .item class in some css file before hand? Then after some user event, I am cleaning both pagination and overflow , containers, I destroy ias and I create a new ias. But nothing seems to ever get called. No json requests or get requests are done with the provided links.

fieg commented 6 years ago

Do I need to have declared .item class in some css file before hand

No, that's not necessary.

Besides the next selector I commented on before, I don't see anything wrong with your configuration. Perhaps it's a timing issue. For example, your pagination isn't finished updating before IAS is initialized. Can you double check on that?

vmitsaras commented 6 years ago

run into the same issue. try this

_createIas: function (){
            if(this._ias){
                this._ias.destroy();
            }
            this._ias = $.ias({
                container: ".route_list_container",
                item: ".item",
                pagination: "#route_list_pagination",
                next: ".next_mini_route",
                delay: 500
            });
            this._ias.extension(new IASSpinnerExtension());
            this._ias.extension(new IASNoneLeftExtension());
            this._ias.next();
        }
fieg commented 4 years ago

This issue is closed because Infinite Ajax Scroll 2 reached end of life and is being superseded by v3.

Suggestions given in this issue were taken into account when working on v3. If you have questions, feedback or think this issue was closed by mistake, please comment on this issue.