0

您好,我有以下 HTML,

    <article id="jobwall">
    <ul>
        <li class="box">Hello World</li>
        <li class="box">Hello World</li>
        <li class="box">Hello World</li>
        <li class="box noRMar">Hello World</li>
        <li class="box">Hello World</li>
        <li class="box">Hello World</li>
        <li class="box">Hello World</li>
    </ul>
</article>

和下面的CSS,

#jobwall { 
        width:100%;
        float:left;
        clear:both;
        overflow:hidden;
        margin:15px 0px 0px 0px;
    }   

    #jobwall li {
        width:221px;
        float:left;
        margin:0px 17px 20px 0px;
        border:1px solid red;

    }

        #jobwall li.noRMar {
            margin:0px 0px 20px 0px;
        }

我正在尝试为 jquery 实现一个名为 Masonary 的插件,我的想法是我可以容纳 4 li 并排浮动,但是当我添加 masonary 时我只能浮动 3,这是我的砌体设置,

$('#jobwall ul').masonry({

          singleMode: false,
          // Disables measuring the width of each floated element.
          // Set to true if floated elements have the same width.
          // default: false

          columnWidth: 241,
          // Width in pixels of 1 column of your grid.
          // default: outer width of the first floated element.

          itemSelector: '.box:visible',
          // Additional selector to specify which elements inside
          // the wrapping element will be rearranged.
          // Required for Infinite Scroll with window resizing.

          resizeable: true,
          // Binds a Masonry call to window resizes 
          // so layout appears fluid.
          // default: true

          animate: true,
          // Animates layout rearrangements.
          // default: false

          saveOptions: true
          // Masonry will use the options from previous Masonry
          // calls by default, so you only have to enter in options once
          // default: true

        });

基本上,我将 li 实现为 masonary ,最终显示将向下滑动的更多内容,并且我需要 li 继续按照它们的顺序浮动。有没有更好的方法来实现这个,或者让砌体允许 4 li 连续

4

1 回答 1

1

4 * 221px(+边距)是否大于页面上的 100% 宽度?

于 2011-04-11T12:13:31.780 回答