Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script>
  $.widget("ui.draggable", $.ui.draggable, {
    _mouseStart: function(event) {
      this._super(event);
      this.origScroll = this.options.scroll;
      if (this.cssPosition==="fixed" || this.hasFixedAncestor) {
        this.options.scroll = false;
      }
    },
    _mouseStop: function(event) {
      this._super(event);
      this.options.scroll = this.origScroll;
    }
  });
</script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<div id="a" style="width:50px;height:100px;position:fixed;top:300px;left:200px;background:red"></div> <div style="width:50px;height:5000px;position:absolute;background:blue"></div> <script> $("#a").draggable(); </script>
</body>
</html>
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers