Jquery 如何防止选项卡重叠?
如果单击了第一个“a”标记,那么我会通过jquery将“selected”类添加到第二个“a”标记中,然后第一个选项卡与第二个重叠。我不想改变它的立场。只需将z索引添加到所选选项卡 我的代码中有什么错误: html: Jquery:Jquery 如何防止选项卡重叠?,jquery,html,css,Jquery,Html,Css,如果单击了第一个“a”标记,那么我会通过jquery将“selected”类添加到第二个“a”标记中,然后第一个选项卡与第二个重叠。我不想改变它的立场。只需将z索引添加到所选选项卡 我的代码中有什么错误: html: Jquery: $(document).ready(function(){ $('#commercial').removeClass('selected'); $('#residential').addClass('selected'); $('.comm
$(document).ready(function(){
$('#commercial').removeClass('selected');
$('#residential').addClass('selected');
$('.commercial').hide();
$('.residential').show();
$('#residential').click(function(){
$('#commercial').removeClass('selected');
$('#residential').addClass('selected');
$('.commercial').hide();
$('.residential').show();
});
$('#commercial').click(function(){
$('#residential').removeClass('selected');
$('#commercial').addClass('selected');
$('.residential').hide();
$('.commercial').show();
});
});
谢谢。我想你说的“我不想改变它的位置”是指左边的和上面的位置。
在你的CSS中;将所选的位置
值更改为相对
,而不是绝对
.kumar-tabs li a.selected {
background: #ffffff;
position: relative; /* « or remove this line */
z-index: 1;
color: #2f2f2f;
}
这里有一个所说的“我不想改变它的位置”,我想你指的是左边的和上面的位置。
在你的CSS中;将所选的位置
值更改为相对
,而不是绝对
.kumar-tabs li a.selected {
background: #ffffff;
position: relative; /* « or remove this line */
z-index: 1;
color: #2f2f2f;
}
这是一个你能提供一个例子吗?你能提供一个例子吗?
.kumar-tabs li a.selected {
background: #ffffff;
position: relative; /* « or remove this line */
z-index: 1;
color: #2f2f2f;
}