I stumbled onto this suuuper simple way to initialize an endless scroller through jQuery
Here is the original SO answer (with only two votes at the time!) - http://stackoverflow.com/a/22055221/3101095
Here is the tiny jQuery plugin - https://github.com/pklauzinski/jscroll
Here is my specific modification and implementation to the original answer (47 lines across entire MVC includes some basic comments on what is happening) - http://laravel.io/bin/qQLk6
I've just realized the first version of my solution only works for simplePaginate() function. Hiding the .pagination links as a callback prevents the use of autoTriggerUntil
at which point the user will need the pagination links to click
My first solution was to check the current page of the pagination links and wrap the .hide() in an if check-
add the new line to your jscroll init autoTriggerUntil: 3
then inside the callback function add
var pagi = $("ul.pagination:visible:first");
(pagi.find("li.active").text() >= 3) ? null : pagi.hide();
or something like that
Hey thanks for the code. I think it will be great once I get it to work. Just trying to figure out line 14: data-url="{{url('link/'.$link->slug)}} not sure what I'm supposed to put in there. Your help would be greatly appreciated. thanks
I have implemented jscroll with laravel pagination and it is working fine. but I am facing another issue with the slideshow. for the posts I am using slideshow. If I click on any item on page a slideshow will open. this is not working from second page onward. for first page it is working.
The javascript doesn't seem to work from the second page onwards. Can anyone help?
@deepakhtsb did you find the solution to your problem?
@QwisoDev Can you suggest something?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community