【发布时间】:2014-06-04 01:16:25
【问题描述】:
对于全屏三栏菜单,我创建了三个绝对定位的 div 框,并使用 JQuery 选择器和切换命令使它们中的每一个都水平扩展为全屏。它可以工作,但我想让动画顺利进行。我怎么能这样做?
这是JSFiddle 代码。
这是 HTML 代码:
<body>
<div id='controls' style="background-color: green;" onclick="fullscreen();">
</div>
<div id='controls_002' style="background-color: yellow;" onclick="fullscreen_002();">
</div>
<div id='controls_003' style="background-color: purple;" onclick="fullscreen_003();">
</div>
这是 JQuery 代码:
$(document).ready(function(){
$('.wrapper div').click(function() {
$(this).toggleClass('active');
$(this).siblings().not(this).toggleClass('hide');
});
});
这是 CSS 代码:
.wrapper{
top: 0px;
left: 0px;
padding: 0px;
width: 100%;
height: 100%;
position: absolute;
}
.blue{
width: 33.33333333%;
height: 100%;
cursor: pointer;
background: blue;
}
.red{
width: 33.33333333%;
height: 100%;
cursor: pointer;
background: red;
}
.green{
width: 33.33333333%;
height: 100%;
cursor: pointer;
background: green;
}
div{
float: left;
}
.active{
height: 100%;
width: 100%;
}
.hide{
display: none;
}
【问题讨论】:
标签: jquery html fullscreen expand smooth