我有以下。它工作正常,但我想在隐藏 .sidebarmenu 时增加 .table 的大小。我怎样才能做到这一点?? 这就是我所拥有的
HTML:
<button id="showmenu" type="button">Hide menu</button>
<div class="sidebarmenu">
This should go left
</div>
<div class="table">
</div>
查询:
$(document).ready(function () {
$('#showmenu').click(function () {
var hidden = $('.sidebarmenu').data('hidden');
$('#showmenu').text(hidden ? 'Hide Menu' : 'Show Menu');
if (hidden) {
$('.sidebarmenu').animate({
left: '0px'
}, 500)
} else {
$('.sidebarmenu').animate({
left: '-200px'
}, 500)
}
$('.sidebarmenu,.image').data("hidden", !hidden);
});
});
CSS:
.sidebarmenu {
position:relative;
float:left;
height:500px;
width:200px;
background:red;
left:0px;
}
.table {
height:500px;
width:300px;
background:pink;
float:left;
left:20px;
}