0

I'm not good in programming and I stuck on making infinite scroll on my website.

Right now I have the code for pagination that looks like this:

    {% set query = craft.entries()
    .section('articles')
    .type('naujienos')
    .limit(15)
     %}

{% paginate query as pageInfo, pageEntries %}

{% for entry in pageEntries %}
   {% include 'blocks/_article-with-text.three'  %}
{% endfor %}

</div>

{% if pageInfo.prevUrl %}<a href="{{ pageInfo.prevUrl }}">Previous Page</a>{% endif %}
{% if pageInfo.nextUrl %}<a href="{{ pageInfo.nextUrl }}">Next Page</a>{% endif %}

It's very much the same as in Craft CMS documentation and I checked all the topics that are in here but couldn't make it work for me. Maybe someone can help me out please?

1

To produce an "infinite scroll" like behavior, you'll need to go further than just pagination with TWIG. You'll need to implement some JavaScript. Metafizzy's Infinite Scroll might be appropriate.

This question has answers that could help you: Infinite scrolling with Craft?

New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.