jQuery的帮助,布局

问题描述:

你好我有以下HTML,jQuery的帮助,布局

<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叫砖石插件,这个想法是,我可以适合4李的浮动彼此相邻,但是当我添加masonary我只能浮动3,这里是我的masonary设置,

$('#jobwall ul')。砌体({

  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 

     }); 

基本上我实现了masonary作为li最终显示进一步的内容将滑下来,我需要李继续按照他们的顺序浮动。是否有更好的方法来实现这一点,或者让4里连续排队?

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

+0

您可能需要使列表中的最后一个元素也没有右边距。 – 2011-04-11 12:20:36