Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it with Masonry? #97

Open
dE1l opened this issue Nov 3, 2017 · 0 comments
Open

How to use it with Masonry? #97

dE1l opened this issue Nov 3, 2017 · 0 comments

Comments

@dE1l
Copy link

dE1l commented Nov 3, 2017

How to use it correctly with Masonry (https://masonry.desandro.com/) ?

I found some information, how i can use it:

  <script type="application/javascript">
    $.endlessPaginate({
      paginateOnScroll: true,
      paginateOnScrollMargin: 3840,
      onCompleted: function(context, fragment) {
        var masonry = $('.gallery').data('masonry');
          if (masonry !== undefined) {
              masonry.reloadItems();
              masonry.layout();
          }}
    });
  </script>

It's working, but it's working incorrectly. It's not reload items at the and of page. Why ?
Please, help me fix it

image

I think i'm found some correctly working solution, but i don't sure, that it's correct way...

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.1.8/imagesloaded.pkgd.min.js"></script>
  <script type="application/javascript">
    $.endlessPaginate({
      paginateOnScroll: true,
      paginateOnScrollMargin: 3840,
      onCompleted: function(context, fragment) {
        $(document).ready(function () {
            var gallery = $('.gallery');
            gallery.imagesLoaded(function () {
                var masonry = gallery.data('masonry');
                if (masonry !== undefined) {
                    masonry.reloadItems();
                    masonry.layout();
                }
            });
        });
      }
    });
  </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant