chriz74's avatar

Pagination HTML element (ul.pagination) takes forever to hide

I followed this tutorial for implementing infinte scroll:

https://laraget.com/blog/implementing-infinite-scroll-pagination-using-laravel-and-jscroll

It works however the pagination links do not get hidden in time.

the code used in the script is $('ul.pagination').hide(); If I scroll down I can see them and they disappear after 1 or 2 seconds. Obviously this is ugly. Any clue? I tried to use var x = document.getElementsByClassName("ul.pagination"); and set the style to display.none but I get an error .. x is undefined (while it is very defined).

0 likes
7 replies
jlrdw's avatar

Why would you need pagination links on infinite scroll. Either paginate normally or use infinite scroll choose one or the other.

See https://discourse.cakephp.org

No pagination links there.

chriz74's avatar

Because the script uses the links to load the rest of the content and if it has no links then it will not load anything more then the first page.

jlrdw's avatar

And you do have

callback: function() {
                $('ul.pagination').remove();
            }
chriz74's avatar

That is triggered in the last page.

jlrdw's avatar

Did you read the comments following the tutorial, seems others have had trouble.

See if the JS scroll site has their own tutorial.

chriz74's avatar

I think I found a simple solution by adding the links in the page inside an hidden div:

<div style="display: none">{{ $posts->links() }}</div>

Please or to participate in this conversation.