html - Smooth JQuery animations for three-column menu with fullscreen expanding div boxes? -


for fullscreen three-column menu i've created 3 absolute-positioned div boxes , made each of them expand horizontally fullscreen jquery selector , toggle command. works, i'd have animation smoothly. how that?

here's jsfiddle code it.

this html code:

<body>     <div id='controls' style="background-color: green;" onclick="fullscreen();">     </div>     <div id='controls_002' style="background-color: yellow;" onclick="fullscreen_002();">     </div>     <div id='controls_003' style="background-color: purple;" onclick="fullscreen_003();">     </div> 

this jquery code:

    $(document).ready(function(){     $('.wrapper div').click(function() {     $(this).toggleclass('active');     $(this).siblings().not(this).toggleclass('hide'); }); }); 

and css code:

    .wrapper{     top: 0px;     left: 0px;     padding: 0px;     width: 100%;     height: 100%;     position: absolute; }  .blue{     width: 33.33333333%;     height: 100%;     cursor: pointer;     background: blue; }  .red{     width: 33.33333333%;     height: 100%;     cursor: pointer;     background: red; }  .green{     width: 33.33333333%;     height: 100%;     cursor: pointer;     background: green; }   div{     float: left; }   .active{     height: 100%;     width: 100%; }  .hide{     display: none; }​ 

or simple jquery code no changes fiddle css code
fiddle

    <script type="text/javascript"> $(document).ready(function(){     $('.wrapper div').click(function() {         $(this).toggleclass('go')         if($(this).hasclass('go')){           $(this).animate({'width':'100%'},{               duration:1000,               step:function(gox){                   var width = gox < 100 ? (100 - gox) / 2 : 0;                   $(this).siblings().css('width', width + "%");                    }               })         }else{             $('.wrapper div').animate({'width':'33.33%'},1000)         }     }); }); </script> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -