2011-04-11 99 views
0

你好我有以下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裏連續排隊?

回答

1

頁面上的4 * 221px(+邊距)是否大於100%寬度?

+0

您可能需要使列表中的最後一個元素也沒有右邊距。 – 2011-04-11 12:20:36