Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style type="text/css">
    #container {
      position: absolute;
      top: 100px;
      left: 100px;
      width: 400px;
      height: 400px;
      background-color: black;
    }
    #elem {
      width: 200px;
      height: 200px;
      background-color: green;
    }
  </style>
</head>
<body>
  <div id="container">
    <div id="elem">drag/resize me</div>
  </div>
</body>
</html>
 
$("#elem")
  .draggable({
    containment: "#container"
  })
  .resizable({
    containment: "#container"
  });
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers