jquery:resizable with scrollable content

Resizeable Div

by Rowan Hamilton

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css">
<!DOCTYPE html>
<html>
<head>
    <title>title</title>
</head>
<body>
  
<div class="resizable">
  Lorem <br/>
  ipsum<br/>
   dolor<br/>
   sit<br/>
   amet<br/>
   Consectetuer<br/>
   Lorem<br/>
   magna<br/>
   mi<br/>
   wisi 

</div>

</body>
</html>

CSS

body{
  height:100%;
}

.resizable { 
width: 350px;
height: 100%; 
background: silver;
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
overflow:hidden;
z-index:-1; /
}

JavaScript

$(document).ready(function() {
	$( window ).height();
  
  
    $(".resizable")
      .wrap('<div/>')
        .css({'overflow':'hidden'})
          .parent()
            .css({'display':'inline-block',
                  'overflow':'hidden',
                  'height':function(){return $('.resizable',this).height();},
                  'width':  function(){return $('.resizable',this).width();},
                  'paddingBottom':'12px',
                  'paddingRight':'12px'
                  
                 }).resizable()
                    .find('.resizable')
                      .css({overflow:'auto',
                            width:'100%',
                            height:'100%'});
  });