2010-02-08 30 views
1

习题相当简单的jQuery的事情,但我希望做这样的事情:从另一个UL LIlist例如JQuery的李onHover选项显示另一个李

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

其中悬停显示图像

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

任何建议,请 - =感谢

+0

你想为每个'li'或'ul'写悬停吗? – rahul 2010-02-08 13:04:36

回答

0

可以使用指数(1.4)方法,以确定哪些小李徘徊。然后使图像可见。这只是一个开始,将需要一些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 
    });