我想在图像悬停时显示删除选项。我不知道该怎么做。所以请各位帮帮我?我的观点是这样的:
<?php include('inc/header.php');?>
<div class="main">
<?php
foreach ($view as $row) {
echo "<div class='grow'>";
echo "<img src='".base_url()."images/".$row->image."' >";
echo "</div>";
}//end for each
?>
</div>
<?php include('inc/footer.php');?>
我的图片已经悬停,但不知道如何在图片中嵌入删除选项。
答案 0 :(得分:0)
添加删除div -
<?php include('inc/header.php');?>
<div class="main">
<?php
foreach ($view as $row) {
echo "<div class='grow'>";
echo "<div class='delete'><a href='#'>delete</a></div>";
echo "<img src='".base_url()."images/".$row->image."' >";
echo "</div>";
}//end for each
?>
</div>
<?php include('inc/footer.php');?>
然后在脚本中编写一个代码来显示/隐藏删除div -
$('.grow').hover(function () {
$(this).find('.delete').show();
},
function () {
$(this).find('.delete').hide();
})