在图像上悬停时显示下拉列表

时间:2013-08-07 06:13:14

标签: jquery html css

我需要使用代码使翻转图像在其下方(文本)创建下拉列表,并在鼠标悬停在下拉列表中或原始图像上时返回原始图像。

任何人都有代码来完成此任务吗?我整天都在改变这个网站的代码,并且非常接近并不完全在那里。

菜单

<table width="830px" border=0 cellspacing=0 cellpadding=0 >
  <tr height="25px">
    <td valign="top" align="left"><a href="aboutus1.php"><img src="images/cti-logo.png"></a></td>

    <td valign="bottom" align="right"><a href="welcome.php">
    <img  src="images/home.jpg" onMouseOver="this.src='images/hover-home.jpg'" onMouseOut="this.src='images/home.jpg'"/>

    <a href="aboutus1.php"  target="content"><img id="id_About" onClick="over('about')"  src="images/aboutus.jpg"  onmouseover="this.src='images/hover-aboutus.jpg'" onMouseOut="if(me2=='about'){}else{this.src='images/aboutus.jpg'}" /></a>

    <a target="content" href="partners.php" ><img onClick="over('partners')" id="id_Partners" src="images/partners.jpg" onMouseOver="this.src='images/hover-partners.jpg'" onMouseOut="if(me2=='partners'){}else{this.src='images/partners.jpg'}" /></a>

    <a href="products1_1.php" target="content"><img onClick="over('products')" id="id_Products" src="images/products.jpg"  onmouseover="this.src='images/hover-products.jpg'" onMouseOut=" if(me2=='products'){}else{this.src='images/products.jpg'}" /></a>

    <a href="contactus.php" target="content"><img id="id_Contactus" onClick="over('contactus')" src="images/contactus.jpg"  onmouseover="this.src='images/hover-contactus.jpg'" onMouseOut=" if(me2=='contactus'){}else{this.src='images/contactus.jpg'}" class="contactus" /></a>
    </td>
  </tr>
  <tr>
    <td colspan="2" class="bar"></td>
  </tr>
</table>

1 个答案:

答案 0 :(得分:0)

看看这个JSFiddle。希望这就是你所需要的。

http://jsfiddle.net/mohsin1303/RtMQh/

HTML代码

<html>
<head>
     <title>This is a demo using CSS Sprites</title>
     <style>
           .myButtonLink {
               display: block;
               width: 100px;
               height: 100px;
               background: url('http://www.justcode.us/wp-content/uploads/2013/04/buttonleafhover.png') bottom;
           }
           .myButtonLink:hover {
               background-position: 0 0;
           }

     </style>
</head>
<body>
<a class="myButtonLink" href="#LinkURL"></a>
</body>
</html>
相关问题