这是我到目前为止所拥有的:
<div style="position: relative;"> <a href="#games">
<div class="sidenavOff">
<img src = "images/card_normal.png" />
<img src = "images/category_icons/icon_games.png" style = "position: absolute; top: 10px; left: 40px;" />
<img src = "images/category_titles/title_games.png" style = "position: absolute; top: 160px; left: 40px;" />
</div>
<div class = "sidenavOver">
<img src = "images/hover/card_hover.png" />
<img src = "images/category_titles/title_games.png" style = "position: absolute; top: 10px; left: 40px;" />
<img src = "images/hover/card_hover_separator.png" style = "position: absolute; top: 40px; left: 40px;" />
Show a bunch of text here
<img src = "images/button_start_normal.png" style = "position: absolute; top: 200px; left: 40px;" />
</div>
</a>
</div>
所以 card.png 是一个记事卡,上面覆盖了多个透明图像。当鼠标离开卡片时,卡片上会显示 icon_games.png 和 title_games.png。我希望这样当鼠标悬停在 card.png、icon_games.png 或 title_games.png 上时(换句话说,只要鼠标指针在卡片中),卡片就会显示元素 title_games.png、card_hover_separator.png、文本描述和 button_start_normal.png,按垂直顺序排列(并且它的位置应该是可编辑的,因为它可能与不悬停时显示的图像不同)。
这是我的 jquery 代码(我以前从未使用过它,所以我很确定这是关闭的。我不太明白):
$(document).ready(function () {
$(“div.sidenavOff”).mouseover(function () {
$(this).removeClass().addClass(“sidenavOver”);
}).mouseout(function () {
$(this).removeClass().addClass(“sidenavOff”);
});
});
以更易于理解的格式,无需悬停:
http://img834.imageshack.us/img834/7026/screenshot20130606at122.png
悬停:
http://imageshack.us/photo/my-images/855/screenshot20130606at122.png/