好的,所以我通过PHP动态生成了图片,因此不一定是相同的图片结果。我在过去的四个小时里扫描了互联网,并尝试了无数使用jQuery和/或CSS的方法,最后找到了下面可行的方法。
<a href="build.php?x=1875&y=2020"><img style='background:url(images/tile_4.jpg)' src='images/tile_4.jpg' onmouseover="this.src='images/Market.png'" onmouseout="this.src='images/tile_4.jpg'" /></a>
<a href="build.php?x=1876&y=2020"><img style='background:url(images/tile_4.jpg)' src='images/tile_4.jpg' onmouseover="this.src='images/Market.png'" onmouseout="this.src='images/tile_4.jpg'" /></a>
<a href="build.php?x=1877&y=2020"><img style='background:url(images/tile_4.jpg)' src='images/tile_4.jpg' onmouseover="this.src='images/Market.png'" onmouseout="this.src='images/tile_4.jpg'" /></a>
<a href="build.php?x=1878&y=2020"><img style='background:url(images/tile_4.jpg)' src='images/tile_4.jpg' onmouseover="this.src='images/Market.png'" onmouseout="this.src='images/tile_4.jpg'" /></a>
<a href="build.php?x=1879&y=2020"><img style='background:url(images/tile_4.jpg)' src='images/tile_4.jpg' onmouseover="this.src='images/Market.png'" onmouseout="this.src='images/tile_4.jpg'" /></a>
Market.png有一个透明的背景。
现在,以上内容有效。当鼠标悬停时,它会显示带有透明背景部分的Market.png和鼠标移开时是tile_4.jpg。
我想知道:是否有任何方法可以使用jQuery或CSS完成与上述完全相同的操作?我还没有想出来,而且尝试了几个小时,但我宁愿做其他事情,如果可能的话,因为上述方法(大量重复,当前格式已重复约100次,但我计划将其扩展到超过1000次)将成为一个带宽占用者。