javascript - Resizable split screen divs using jquery UI -


i have design in mind involves split panel view in html, similar winforms split panel. i've been expirimenting jquery ui - resizable , function, can't seem co-ordinate resizing of 2 divs. problem current code 2 divs resize away each other, not 1 following other. how can make 2 divs work together?

<html>     <head>         <title>test</title>         <link rel="stylesheet" type="text/css" href="css/custom.css" />         <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen">         <link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.10.custom.css" media="screen">         <script type="text/javascript" src="script/jquery-1.5.1.js"></script>         <script type="text/javascript" src="script/superfish.js"></script>         <script type="text/javascript" src="script/jquery-ui-1.8.10.custom.min.js"></script>         <script type="text/javascript">           // initialise plugins         $(function(){             try {                 $('ul.sf-menu').superfish();                  //set divs                 $('#content').resizable({ handles: 'e', alsoresize: $('#attributes')});              }catch(ex){                 alert(ex.message);             }         });          </script>     </head>     <body>        <div id="header">             <div id="menu">                 <ul class="sf-menu" id="nav">                     <!-- snip menu -->                 </ul>             </div>         </div>         <div id="middle">             <div id="content" class="ui-widget-content">this view is.<br/>             imagine image here ...             <br/>             <br/>             <br/>             </div>             <div id="attributes" class="ui-widget-content">                 <ul>                     <li>a</li>                     <li>b</li>                     <li>c</li>                 </ul>             </div>         </div>         <div id="footbreak"/>         <div id="footer">             <a href="#">help</a>         </div>     </body> </html> 

i have worked out reasonable hack, using resize event.

<script type="text/javascript">      var width_attr = 'initwidth';      // initialise plugins     $(function(){         try {             $('#content').resizable({ handles: 'e', resize: resizeattr });              $('#content').attr(width_attr, $('#content').width());             $('#infopanel').attr(width_attr, $('#infopanel').width());         }catch(ex){             alert(ex.message);         }     });      function resizeattr(event, ui){         var change = ui.size.width - $('#content').attr(width_attr);         $('#infopanel').width($('#infopanel').attr(width_attr) - change);     };  </script> 

i'm still open cleaner answers others...


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -