使用 jQuery Masonry IsAnimatedFromBottom

发布于 2024-12-02 18:12:44 字数 1302 浏览 1 评论 0原文

目前,当我将新项目附加到砖石容器时,它们会添加到左上角,然后飞到适当的位置。但是,在砌体网站的此示例中,新元素出现在底部。

它在演示描述中说演示“使用 IsAnimatedFromBottom 标志”,但查看代码我看不到它:

<script> 
  $(function(){

    var $container = $('#container');

    $container.imagesLoaded(function(){
      $container.masonry({
        itemSelector: '.box',
        columnWidth: 100
      });
    });

    $container.infinitescroll({
      navSelector  : '#page-nav',    // selector for the paged navigation 
      nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)
      itemSelector : '.box',     // selector for all items you'll retrieve
      loading: {
          finishedMsg: 'No more pages to load.',
          img: 'http://i.imgur.com/6RMhx.gif'
        }
      },
      // trigger Masonry as a callback
      function( newElements ) {
        var $newElems = $( newElements );
        // ensure that images load before adding to masonry layout
        $newElems.imagesLoaded(function(){
          $container.masonry( 'appended', $newElems, true ); 
        });
      }
    );

  });
</script> 

同时查看列出的 options 它似乎没有列出,所以有人知道它是如何使用的吗?

Currently when I append new items to my masonry container they are added in the top left corner and then fly into position. However, in this example on the masonry website the new elements appear at the bottom.

It says in the demo description that the demo 'makes use of the IsAnimatedFromBottom flag', but looking at the code I can't see it:

<script> 
  $(function(){

    var $container = $('#container');

    $container.imagesLoaded(function(){
      $container.masonry({
        itemSelector: '.box',
        columnWidth: 100
      });
    });

    $container.infinitescroll({
      navSelector  : '#page-nav',    // selector for the paged navigation 
      nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)
      itemSelector : '.box',     // selector for all items you'll retrieve
      loading: {
          finishedMsg: 'No more pages to load.',
          img: 'http://i.imgur.com/6RMhx.gif'
        }
      },
      // trigger Masonry as a callback
      function( newElements ) {
        var $newElems = $( newElements );
        // ensure that images load before adding to masonry layout
        $newElems.imagesLoaded(function(){
          $container.masonry( 'appended', $newElems, true ); 
        });
      }
    );

  });
</script> 

Also looking at the listed options it doesn't appear to be listed, so does anyone know how this is used?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

双马尾 2024-12-09 18:12:44

我自己也遇到了一些麻烦。我认为你实际上想将标志设置为 true 所以而不是

.masonry( 'appended', $content, isAnimatedFromBottom )

你想要

.masonry( 'appended', $content, true)

Was having some trouble with this myself. I think you actually want to set the flag to true so instead of

.masonry( 'appended', $content, isAnimatedFromBottom )

you would want

.masonry( 'appended', $content, true)
白芷 2024-12-09 18:12:44

抱歉,总是这样,一发帖就找到答案了!该标志不是配置设置,而是附加方法的参数

.masonry( 'appended', $content, isAnimatedFromBottom)

Sorry, always the way, found the answer as soon as I posted! The flag isn't a config setting, but a parameter for the appended method

.masonry( 'appended', $content, isAnimatedFromBottom)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文