Link to home
Start Free TrialLog in
Avatar of DS928
DS928Flag for United States of America

asked on

Enlarging a Div

When I click on a link I am trying to get a div to enlarge.  The div is called "sidebox".  The website is www.mediascrubber.com  The div is the white box with the grey line around it.

<ul id="bars">
		<li><a href="#!/page_One">One</a><!-- Begin One -->
    	<li id="page_One">
			<div id="sidebox" class="sidebig">
			</div>
		</li>
    	</li><!-- End One -->
	</ul>

Open in new window


I want it to work like www.legalzoom.com
Avatar of Gary
Gary
Flag of Ireland image

This is based no jquery - I'm sure you can easily adapt it to your particular code
http://jsfiddle.net/GaryC123/6adEM/1/

HTML
<div id="container">
    <div class="buttons">
    <button id="but1">button 1</button>
    <button id="but2">button 1</button>
    </div>
    <div class="content">
    <span class="but1">some text</span>
    <span class="but2">some other text</span>
    </div>
</div>

Open in new window

CSS
#container {
    height:100px;
    width:100px;
    overflow:hidden;
    border:1px solid green
}
.buttons {
    width:90px;display:inline:block;float:left
}
.content span{
    width:90px;
    display:inline-block;
    float:left;
    display:none
}

Open in new window

JQUERY
$("#container").mouseenter(function(){
        $(this).animate({width: '200px'});
})
$("#container").mouseleave(function(){
        $(this).animate({width: '100px'});
})
$(".buttons button").hover(function(){
  $(".content ."+$(this).attr("id")).toggle()  
})

Open in new window

Avatar of DS928

ASKER

Your example works great.  Mine doesn't.  I copied all of the code and it doesn't seem to work.  Could it be my jquery version?

<script type="text/javascript" src="js/jquery-1.7.2.min.js" ></script>
<script>
		$("#container").mouseenter(function(){
        $(this).animate({width: '200px'});
		})
		$("#container").mouseleave(function(){
        $(this).animate({width: '100px'});
		})
		$(".buttons button").hover(function(){
  		$(".content ."+$(this).attr("id")).toggle()  
		})
</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DS928

ASKER

Bingo!  That was it!  Thank you.