Any easy way to limit how many links are shown with Laravels pagination?
Currently it shows 13 links at most (Prev, 1 2 3 4 5 7 8 .. 78 79 next)
This however is too much for mobile devices and becomes a two line navigation... is there any way to set the links to e.g. only show 10?
I have messed around with the pagination presenter but nothing actually seemed to work.
Thanks
I used css to limit the links that I allowed. Really simple.. this can be extended to show any number of pages, at any number of breakpoints
@media screen and ( max-width: 400px ){ li.page-item { display: none; } .page-item:first-child, .page-item:nth-child( 2 ), .page-item:nth-last-child( 2 ), .page-item:last-child, .page-item.active, .page-item.disabled { display: block; } }
this specific implementation allows the arrows, the '...', the first page, active page and last page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With