CMS load — Next button is refreshing the page

Hi there

First of all, thanks for reading this.
I have a review section on the mobile version of this link:

It is a bit down on the screen.

I implemented the CMS load more attribute, and I swear it used to work perfectly a while back.
But for some reason, it now refreshes the page when clicking the ‘load more’ button
I looked for over an hour, but cannot find the issue.
Any help would be appreciated.

Read-only:
https://preview.webflow.com/preview/pili-pili-pili?utm_medium=preview_link&utm_source=designer&utm_content=pili-pili-pili&preview=6e19e9bd87ecddd2d30137c0f2fcbe01&pageId=65f96c1943c0f97a4476cd1e&workflow=preview

Kind regards
Phil

Hey @phil1! You’ve misplaced the load mode attribute, it should go with the fs-cmsload-element='list', not on the button itself :wink:

Hi Luis

Thanks for your reply.

Unfortunately still no luck.
Both attributes are now on the collection list.
Still refreshing after clicking the ‘load more’ button.

image

Hey @phil1! I found the source of the issue, you have added a snippet of custom code to handle link clicks

      // Code that runs on click of a link
      $(document).ready(function () {
        $('a').on('click', function (e) {
          console.log('button clicked');
          if (
            $(this).prop('hostname') === window.location.host &&
            $(this).attr('href').indexOf('#') === -1 &&
            $(this).attr('target') !== '_blank'
          ) {
            e.preventDefault();
            let destination = $(this).attr('href');
            gsap.to('.page-wrapper', {
              opacity: 0,
              duration: 0.8,
              ease: 'power3.out',
              onComplete: () => {
                window.location = destination;
              },
            });
          }
        });

        // On click of the back button
        window.onpageshow = function (event) {
          if (event.persisted) {
            window.location.reload();
          }
        };
      });

This is refreshing the page after the “Load more” button is clicked. Commenting it out loads the items as expected.

Wooooow absolutely right.
Thanks a lot for this. Really appreciate it.

1 Like