在我看來,我有一個巨大的問題。或只是理解懸停功能的問題。我嘗試了很多方法,閱讀了很多教程,但沒有得到這個東西,我需要什麼。這可能是愚蠢的,但我使用jQuery的前端管理面板具有較低的知識技能。懸停並顯示管理按鈕
正如您在this image中看到的,這是一個普通的eshop列表。我想做的是,如果你是管理員,當你懸停一個項目,那麼你可以看到管理按鈕,就像在this image,但只有在懸停的項目。請幫助我輕鬆搞定。
不管怎麼說,這是我的頁面的這部分代碼:
<!-- Script -->
<script type="text/javascript">
$(document).ready(function(){
$(".admin_item").hide();
$('.item').hover(function() {
$(".admin_item").slideToggle(".admin_item");
});
});
</script>
<!-- $admin_item -->
<?
$admin_item = '<div class="admin_item" style="position: absolute; padding-left: 380px;"><a href="?edit"><img src="style/icon/pencil.png" alt="" /></a><a href="?delete"><img src="style/icon/delete.png" alt="" /></a></div><div class="clear"></div>';
?>
<!-- list -->
<div class="page_content" id="goods">
<?
$items = array (
1 => array("Lorem ipsum dolor sit amet, consectetur adipiscing elit.","3.65","List 3-1"),
2 => array("Proin ut est ut purus venenatis suscipit tristique id mi.","4.00","List 3-2"),
3 => array("Integer posuere mauris dapibus massa malesuada id malesuada velit congue.","5.49","List 3-3"),
4 => array("Vivamus eu purus quam, ut convallis urna.","7.40","List 3-2"),
5 => array("Suspendisse eu felis erat, ut mollis erat.","8.20","List 3-1"),
6 => array("Morbi malesuada facilisis neque, at dapibus nibh elementum quis.","9.85","List 3-1"),
7 => array("Proin euismod mauris ac lorem sodales faucibus.","10.00","List 3-2"),
8 => array("Maecenas vitae neque ac nibh venenatis laoreet nec sed nisi.","12.90","List 3-3"),
);
$i=1;
foreach($items as $item) :
?>
<?=$admin_item?>
<div class="item">
<div class="details floatleft">
<div class="image floatleft"><img src="images/items/example/thumbs/<?=$i?>_s.jpg" alt=""></div>
<div class="description floatleft"><?=$item[0]?></div>
<div class="price floatleft">LVL <?=$item[1]?></div>
<div class="category floatleft"><?=$item[2]?></div>
</div>
<div class="cart floatleft"><img src="style/shopping_cart.png" alt="" /></div>
</div>
<div class="clear"></div>
<? $i++; endforeach;?>
</div>
是的,實際上,這是正確的,你說的持續時間等,但我希望這會工作... – RobertR 2010-11-22 21:46:40