3

I have a view block that list contents.

What I want to do is to show only 5 items in this view and a load more link at the bottom of the view and if this link clicked, then show all remaining content of the view.

I tried the Views Load More module and the Views Infinite Scroll module. The Views Load More module didn't work, the Views Infinite Scroll module works good but I couldn't do what I want. It has an option to show X items per "show more" link clicked but it doesn't have an option to show all the remaining content of the view.

How to load all remaining content of a view after clicking a "load more" link?

enter image description here

  • 1
    I hesitate to post this as an answer (I might, if it makes sense ...): (1) clone that views block in a new views block that shows all content (2) adapt your views block to only show 5 items, and in its footer add a link with title "show more", which links to the same path, but with (say) "show_more" added to it. Then use block visibility settings to only show either block on relevant paths (pages). Makes sense? Or not at all? – Pierre.Vriens Jul 19 '16 at 13:44
  • Thanks @Pierre.Vriens for your answer :) Hımm, I want to do this without refreshing/redirecting the page. I will try your solution if I can't find a "better" way. Thanks again. – herci Jul 19 '16 at 13:48
  • 1
    It's a "comment" only (not an "answer") ... Ping me about it if you ever want me to convert it to an answer anyway. I'm also curious for "other" answers ... Have a nice day! – Pierre.Vriens Jul 19 '16 at 13:54
3

You need Views show more module with ajax under views advanced setting. This module provides Initial item selection option, and rest of the item you can put in the section of on-click.

Steps-

  1. Download and enable the module.

  2. Select show more pager in the Pager section as shown in the image. Then go for setting for that. Now in my case I took 15 items, and I want to initially show 5 items and on clicking rest of the item. So I did put 5 under the Initial items and 10 items under Items to display as shown in second image. And under Animation section select Scroll to new content. Save this, so pager setting ends here.

  3. Under advanced setting of views enable, Use Ajax: Yes

Views Block UI Views UI

Pager UI

Pager UI

Out put image:

Initial stage

enter image description here

After clicking show more

enter image description here

It does not require the page refresh to load content.

| improve this answer | |
  • 1
    Thanks a lot for the answer. It does what I exactly need. I'm using the EVA module and at first it doesn't work then I found that (drupal.org/node/2672220) and then it worked. – herci Jul 19 '16 at 18:23

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.