87,990
社区成员
发帖
与我相关
我的任务
分享.menu div div div
{
width: 1024px;
clear: both;
margin-left: 0px;
}
.item, .item div a
{
text-align: center;
width: 100px;
border-style: solid;
text-decoration: none;
color: #000;
border-color: #000;
border-width: 1px;
float: left;
margin: 0px;
display: inline;
height: 26px;
line-height: 26px;
font-size: 18px;
background-color: #ffa;
}
.item div a:hover,.itemfocused
{
height: 32px;
line-height: 32px;
font-size: 26px;
background-color: #aaf;
}
.item:hover
{
background-color: #aaf;
}
.menu
{
height: 32px;
}
.menu div
{
float: left;
width: 100px;
}
$(
function () {
var childmousenter = false;
$(".item").each(function (i) {
$(":first-child", this).hide();
$(this).bind("click", function () {
if ($(":first-child", this).css("display") == "none") {
$(":first-child", this).show();
$(this).addClass(".itemfocused");
}
else {
$(":first-child", this).hide();
$(this).removeClass(".itemfocused");
}
});
$(this).bind("focusout",function () { $(":first-child", this).hide(200); });
$(":first-child", this).bind("focusout", function () { $(":first-child", this).hide(); });
var lenght = $("a", $(":first-child", this)).length * 102;
$("div", this).width(lenght);
});
});
<div class="menu">
<div>
<div class="item" style="clear: both;">
111<div style="background: #000;width:400px;">
<a href="http://localhost/8080" target="_blank">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a>
</div>
</div>
</div>
<div>
<div class="item" style="clear: both;">
111
<div style="background: #000;">
<a href="http://localhost/8080" target="_blank">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">4</a>
</div>
</div>
</div>
