您可以为此使用 css,但旧版本的 IE 不支持此功能。而且我也不确定这是否是您想要/需要的。但无论哪种方式,希望这会有所帮助。
将 .prop_info 的以下 CSS 更改为:
.property .prop_info {
width:274px;
height:90px;
background:url(/resources/images/backgrounds/agent-info-bg.jpg) top left no-repeat transparent;
background: #0d70b2;
position:absolute;
left:136px;
top: 0px;
display: none;
z-index: 10;
}
然后在下面添加:
.property:hover .prop_info {
display: block;
}
这样做的目的是,每当您将鼠标悬停在 .property 元素上时,其中的 .prop_info 元素就会变得可见。但是,这需要您更改 html 布局,以便 .prop_info 现在位于 .property 中,如下所示:
<div class="property" id="property{count}" style="display: block;">
<a href="#"><img src="http://placehold.it/136x90/eeeeee/cccccc/&text=placeholder" /></a>
<div class="prop_info">
<div id="property_info_content">[ content goes here ]</div>
</div>
</div>
对于通常会超出屏幕的每个元素,第 5 或第 4 .. 我现在无法测试,因为这完全取决于网站的宽度以及它是否会变得自适应。
但您可以使用以下 CSS:
.property .prop_info:nth-child(4n+4) {
left: -410px;
}
它的作用是它给每个第 4 个元素找到一个不同的左边距。如果你需要它是每 5 个,只需将 4n+4 更改为 5n+5。
希望这有帮助