Nie działa
To z demo + Twoja funkcja
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" language="javascript" src="jquery-1.2.3.min.js"></script> <script type="text/javascript" language="javascript"> $(document).ready(function() {
// LEFT COLUMN:
// When the collapse button is clicked:
$('.collapseLeft').click(function() {
$('.collapseLeft').css("display","none");
$('.expandLeft').css("display","block");
$('#leftCol').animate( {height:"20px"}, {duration:400} );
});
// When the expand button is clicked:
$('.expandLeft').click(function() {
$('.expandLeft').css("display","none");
$('.collapseLeft').css("display","block");
$('#leftCol').animate( {height:"500px"}, {duration:500} );
});
// RIGHT COLUMN:
// When the collapse button is clicked:
$('.collapseRight').click(function() {
$('.collapseRight').css("display","none");
$('.expandRight').css("display","block");
$('#rightCol').animate( {height:"20px"}, {duration:400} );
});
// When the expand button is clicked:
$('.expandRight').click(function() {
$('.expandRight').css("display","none");
$('.collapseRight').css("display","block");
$('#rightCol').animate( {height:"500px"}, {duration:500} );
});
});
body {
background-color:#444444;
position:relative;
}
#page {
width:500px;
margin:0 auto;
text-align:center;
background-color:#222222;
padding:1px;
}
#leftCol {
width:149px;
margin-right:1px;
height:500px;
float:left;
background-color:#666666;
position:relative;
}
#rightCol {
width:350px;
height:500px;
float:left;
background-color:#333333;
position:relative;
}
.expandLeft, .expandRight {
width:11px;
height:11px;
background:url(http://www.shopdev.co.uk/blog/expand.gif) no-repeat;
position:absolute;
right:5px;
top:4px;
display:none;
}
.collapseLeft, .collapseRight {
width:11px;
height:11px;
background:url(http://www.shopdev.co.uk/blog/collapse.gif) no-repeat;
position:absolute;
right:5px;
top:4px;
}
<div class="collapseLeft"></div> <div class="expandLeft"></div> <div class="collapseRight"></div> <div class="expandRight"></div>