What am I doing:
I am working on a site with two different โsidesโ, when you click on the left side, the left side should be 100%. If you click on the right side, the right side should be 100%.
Done already:
I made the left and right side. And animated it using jQuery.
Problem
When you click the left div, the animation works (it only worked when I added the absolute position), but when I try to create the same animation for the right side; he does not work! I created jsFiddle so you can see the current code: http://jsfiddle.net/sh3Rg/
I can not do the right job. When you click on the right div; he needs to revive up to 100%. Like the left.
code
You can preview the preview and code here: http://jsfiddle.net/sh3Rg/
HTML:
<div id="left"></div> <div id="right"></div>
JS:
<script> $('#left').click(function(){ $('#left').animate({width:'100%'}, 2500); }); </script> <script> $('#right').click(function(){ $('#right').animate({width:'100%'}, 2500); }); </script>
CSS
html,body { padding:0; margin:0; height:100%; min-height:100%; background-color: #000000; } p { cursor: pointer; color: #FFF; } #left { width: 50%; height: 100%; background: #666; float: left; cursor: pointer; position: absolute; } #right { width: 50%; height: 100%; background: #063; float: right; cursor: pointer; }
Hope someone can help me. Regards, Milan
PS: If I posted / did something wrong in this thread; Sorry, this is my first question.
Milan source share