I want to apply resizable simultaneously with draggable for a div and it should be contained within its parent div but on dragging towards the left or top corner and resizing it from north-west,west,south-west handles makes the div widthless..
<!DOCTYPE html>
<html>
<head>
<title>Resizable</title>
<script src="https://code.jquery.com/jquery-1.12.4.js">
</script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js">
</script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style type = "text/css">
#primary
{
width : 30rem;
height : 30rem;
background-color:green;
margin: auto;
}
#draggable{
width: 15rem;
height: 15rem;
background-color: yellow;
}
.ui-widget-content{
background: yellow;
}
</style>
</head>
<body>
<div id = "primary">
<div id= "draggable" class="ui-widget-content">
</div>
</div>
<script >
w= parseInt($('#draggable').css('width'),10);
h= parseInt($('#draggable').css('height'),10);
$( function() {
$( "#draggable" ).resizable( {handles: 'ne , nw ,se,
sw , n ,e ,s,w', minWidth : w, minHeight : h ,containment:"parent"
}).draggable({containment: "parent"});
} );
</script>
</body>
</html>