[英]show a div depending on the selection
I have the following http://jsbin.com/useqa4/10 我有以下http://jsbin.com/useqa4/10
My question is this: In the submenu I hover some li elements using the following 我的问题是:在子菜单中,我使用以下内容悬停了一些li元素:
$(".submenuList li").hover(function () {
$(".submenuCurrent").removeClass("submenuCurrent");
$(this).addClass("submenuCurrent");
});
When I rollover on any of these the right section I want to change and show a specific div. 当我将鼠标悬停在任何这些正确的部分上时,我想更改并显示特定的div。
For example: 例如:
for the first li the div #prasentRight
对于第一个li div
#prasentRight
for the second li the div #elitRight
对于第二个li div
#elitRight
for the third li the div #suspendisseRight
对于第三个li div
#suspendisseRight
for the forth li the div #laoreetRight
对于
#laoreetRight
div #laoreetRight
My difficult is that I don't know how to get the current index of .submenuList li
我的困难是我不知道如何获取
.submenuList li
的当前索引。
Any help? 有什么帮助吗?
I think that this should work: 我认为这应该有效:
$('submenuList li').hover(
function(){
var thisIndex = $(this).index();
$(this).attr('title',thisIndex);
});
Shows the current index of the hovered-over list items in the title
attribute of the element, demo at JS Bin . 在元素的
title
属性( JS Bin中的demo)中显示悬停的列表项的当前索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.