English 中文(简体)
未适当打字的图像
原标题:Images not stacking properly

I m使用jquery masonry,并遇到麻烦,难以找到图像/海报以适当打脚(见所附图像)。

The problem is that there is too much white space/ gap between the posts/images.

我如何确定这一点?

感谢

Faisal

INDEX./2006/2。

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="/assets/jquery.js"></script>
<script src="/assets/jquery.masonry.min.js"></script>
<style>
  .item {
   width: 200px;
   margin: 8px;
   float: left;
   border: 1px solid #999999; 
   background-color: #F7F7F7; 
   -moz-border-radius: 10px; 
   -webkit-border-radius: 10px; 
   padding: 6px;
   color: black;
   }

</style>
<div id="container">
<br />
<br />
<br />
<% @posts.each do |post| %>
<div class="item">
<%= post.body %>
<br />
<%= post.title %> 
<br />
<i>RSVP -- <%= post.job %>.</i>
<br />
<i>Created <%= time_ago_in_words(post.created_at) %> ago.</i>
</div>
<script type="text/javascript">

$(window).load() { 
$( #container ).masonry({
  itemSelector:  .box ,
  columnWidth: function( containerWidth ) {
  return containerWidth / 5;
  });
});
</script>
<% end %>
</div>

“entergraph

最佳回答

JSfiddle将是好的,并尝试利用联合后勤系统。

正如平等部所指出的......

<代码>(文件)ready(功能)。

赢得工作,但(功能)轨道是首先尝试的。 您也可使用<条码>gutterWidth(masonry)。

UPDATE:

我敲响了你 made的笑.,清理了某些法典(许多多余的 j印片等),并投入工作。 我先在泥炭等地使用这些建议,但应当有理。 http://jsfiddle.net/8KHAh/11/ rel=“nofollow noreferer” http://jsfiddle.net/8KHAh/11/

$(function(){
  $( #container ).masonry({
    // options
    itemSelector :  .item ,
    columnWidth : 226
  });
});

确保你使用类似的特别安全标准或调整<代码>columnWidth,以适应婚礼等。

问题回答

我只是首先看了“Qu鱼”,从这种看看看,也许 p的 t头根本不行? 在我手法中出现yn误时,通常会发生这种情况。 你们的《共同愿景》看着一个小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小小,。 使用:

$(function() {
  $( #container ).masonry({
    itemSelector:  .box ,
    columnWidth: function( containerWidth ) {
      return containerWidth / 5;
    }
  });
});

这需要工作。

这里,为什么必须进行适当的tation,如果你有的话,问题(和解决办法)将几乎立即显而易见。 首先,你呼吁:

$(window).load() { /* your code goes here */ }

这两项声明完全分开,几乎与:

$(window).load(); /* your code goes here */

您需要将匿名功能作为参数通过.load(),如:

$(window).load ( function() { /* your code goes here */ } )

此外,在界定<代码>栏目后,你在您的环境下拥有半分辨率。 缩略语

{
   name1:  value1 ,
   name2:  value2 ; // <-- SYNTAX ERROR
   name3:  value3 , // it s okay to leave a trailing comma, though
}

That one always gets me, too, but it s much easier to see with proper indentation.

结 论:教授indentation<>。 此外,利用你的浏览器JS console来检查yn子的错误;单单单单是帮助弄清错误。

Im not familiar with masonry but i show you have a 8px margin and a 6px padding. I would start by trying to reduce those, maybe two or three pixels. If that didn t give me anything i would add a border to that class and find out exactly what it was affecting





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...