嗨,我有一个标题,这是固定的位置和宽度100%,我也有一个侧边栏,从左边滑出来,它也是固定的位置。问题是边栏与标题重叠,当侧栏滑出时,我希望边栏与边栏一起收缩。我认为它会很自然地做到这一点,因为它被设置为100%宽度。但事实并非如此。
有什么想法吗?
谢谢
标题
#header_wrapper{
width:100%;
height: 50px;
/*background-color: #dddddd;*/
background-color: #2a5f8c;
border-bottom: 2px solid #ffffff;
float: left;
position: fixed;
z-index: 80;
border-bottom: 1px solid #444444;
}侧边栏
#category_wrapper{
width: 200px;
height: 100%;
position: fixed;
float: left;
border-right: 3px solid #333;
display: none;
}Jquery
$("#header_category").click(function () {
$('#category_wrapper').toggle(200);
});HTML
<div id="category_wrapper"></div><!--end category_wrapper-->
<div id="header_wrapper"></div><!--end header_wrapper-->发布于 2013-12-13 12:44:28
而不是将标题的宽度设置为100%,您可以将左侧属性设置为0px,右侧属性设置为0px,然后当菜单滑出时,只需将左侧属性动画到左侧菜单的宽度,然后当它返回动画时,将其动画化为零。
动画示例:
$( "#category_wrapper" ).animate({
left: 200,
}, 200, function() {
// Animation complete.
});https://stackoverflow.com/questions/20566639
复制相似问题