-2

在鼠标悬停时显示没有失真的大图像图像也来自使用 php 的数据库,所以我的问题是任何简单的方法都存在于 jquery css javascript 等中,这将是最简单的谢谢。

这是从数据库中显示图像的代码

     <div>
   <table>
<tr>
  <td>
    ?php
    $query = "SELECT * from images";
   $result = mysql_query($query);
  while($fetch = mysql_fetch_array($result)) {
  echo "<img src=\"http://localhost/images_path/{$fetch['image']}\" width=\"15%\"     height=\"135px\">"." &nbsp";
}
?>

</td>
</tr>

</table>

</div>
4

1 回答 1

2

你可以用一个简单的css..

div.img img { height: 90px; width: 110px; }
div.img img:hover { height: auto; width: auto; }

另一种方法可能

function mouseOver()
{
var img1 = document.getElementById("img1");
img1.src ="images/p2.jpg";
img1.width = "";
img1.height = "";
}
function mouseOut()
{
var img1 = document.getElementById("img1");
img1.src ="images/p1.jpg";
img1.width = "90";
img1.height = "110";
}

也看看这个JSFIDDLE DEMO

于 2013-08-24T04:01:55.513 回答