我正在试验一个选项卡脚本,该脚本将根据您悬停在哪个选项卡上显示不同的信息。我正在尝试使用选项卡和主内容窗口上的透明背景颜色来做到这一点。选项卡的右边框是隐藏的,这很好,但是可以通过透明背景看到主要内容的边框。我希望图形从选项卡流向内容,但我不知道如何将边框隐藏在活动选项卡右侧的位置。我创建了一个 JSFiddle 页面来提供视觉效果。
HTML:
<div id="vtab">
<ul>
<li class="home selected"></li>
<li class="login"></li>
<li class="support"></li>
</ul>
<div>
<h1>Profile 1</h1>
<p>This is where profile 1 will go</p>
</div>
<div>
<h1>Profile 2</h1>
<p>This is where profile 2 will go</p>
</div>
<div>
<h1>Profile 3</h1>
<p>This is where profile 3 will go</p>
</div>
</div>
CSS:
body {
background: black;
font-family: verdana;
padding-top: 50px;
color: white;
}
#vtab {
margin: auto;
width: 900px;
height: 100%;
}
#vtab > ul > li {
width: 440px;
height: 90px;
background-color: rgba(23,23,23,.5) !important;
list-style-type: none;
display: block;
text-align: center;
margin: auto;
padding-bottom: 10px;
border: 2px solid #a9a9a9;
border-radius: 15px 0 0 15px;
border-collapse: collapse;
position: relative;
border-right: none;
opacity: .3;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30);
}
#vtab > ul > li.selected {
opacity: 1;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
border: 2px solid #a9a9a9;
border-right: none;
z-index: 10;
background-color: rgba(23,23,23,.5) !important;
position: relative;
}
#vtab > ul {
float: left;
width: 440px;
text-align: left;
display: block;
margin: auto 0;
padding: 0;
position: relative;
top: 80px;
}
#vtab > div {
background-color: rgba(23,23,23,.5);
margin-left: 440px;
border: 2px solid #a9a9a9;
min-height: 500px;
padding: 12px;
position: relative;
z-index: 9;
-moz-border-radius: 20px;
}
Javascript:
$(function() {
var $items = $('#vtab>ul>li');
$items.mouseover(function() {
$items.removeClass('selected');
$(this).addClass('selected');
var index = $items.index($(this));
$('#vtab>div').hide().eq(index).show();
}).eq(1).mouseover();
});