I am looking for a solution to adjust the width of the blue div to 100% when hiding the red div. Can anyone help with this? Here is my JavaScript code
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#button").toggle(function() {
$(this).text('Show Content');
}, function() {
$(this).text('Hide Content');
}).click(function(){
$("#red").slideToggle("slow");
});
});
</script>
My style
<style>
#red {
width: 50%;
border: 5px solid red;
float: left
}
.blue {
float: left;
border: 5px solid #00F;
}
</style>
And here is my HTML code
<a href="#" id="button" class="button_style">Hide content</a> <br/>
<div id="red">Content</div>
<div class="blue"> </div>