1

Prob 很简单的 JQuery 事情,但我想做这样的事情:

<ul>
<li>menu item1</li>
<li>menu item2</li>
</ul>

悬停显示来自另一个 UL LIlist 的图像,例如

<ul>
<li>image 1</li>
<li>Image 2</li>
</ul>

请有任何建议-=谢谢

4

2 回答 2

0

您可以使用 index (1.4) 方法来确定悬停的 li。然后使图像可见。这只是一个开始,需要一些 CSS 等来使它看起来不错。

   $("otherUl li").hide(); //hide all images to start
   $("#myUL li").hover(function(){
         i = $(this).index(); //gets the current index 0 based
         $("#otherUL li:nth-child(i+1)").show();//gets the index of the image element 1 based
    }
   , function(){
         $("#otherUL li").hide(); //hide all on mouse out
     }); 
于 2010-02-08T13:27:36.990 回答
0

你需要类似这样的东西,但 lil 有点修改:)

于 2010-02-08T13:07:32.360 回答