简体   繁体   English

水平菜单悬停div内容显示

[英]horizontal menu li hover div content show

I have two div elements in my html page.Left side div contains horizontal list of anchor elements.Right side div contains content for current anchor element on which mouse hovers,It should change when i hover the mouse on a link present in left side div.When i hover the mouse outside, the last items content should display on right side div. 我的html页面中有两个div元素。左侧div包含锚元素的水平列表。右侧div包含鼠标悬停在其上的当前锚元素的内容,当我将鼠标悬停在左侧div中存在的链接上时,它应该发生变化当我将鼠标悬停在外部时,最后一项内容应显示在div右侧。

Any help using javascript or jquery? 使用javascript或jquery有帮助吗?

You can add a data-showdiv attribute to your a link with the div id in it. 您可以将data-showdiv属性添加到带有div ID的链接中。 put all content div with a class and id in display:none; 将所有具有类和ID的内容div放在display:none中; then with jquery : 然后用jquery:

$('a.item').hover(function(){
   $('.class').hide();
   $('#'+$(this).data('showdiv')).show();

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM