JSFiddle - React, Tailwind, and code Playground

by TJ VanToll

HTML

<!--<script src="http://code.jquery.com/jquery-1.8.2.js"></script>-->
<!-- Bug only occurs with jQuery version <= 1.4.2 -->
<script src="http://code.jquery.com/jquery-1.4.2.js"></script>

<link href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>

<div class="demo">
    <br/><br/><br/><br/>Originally, the div is below this text.
    <a href="#" onclick="$('#resizable').css('top',0)">Set div position to top:0</a> 
    Now manually resize the div. The box "jumps" to its original position.
    <div id="resizable" class="ui-widget-content">
        <h3 class="ui-widget-header">Ghost</h3>
    </div>    
</div>
<div class="demo-description"></div>

CSS

#resizable { width: 150px; height: 150px; padding: 0.5em; position:absolute; }
#resizable h3 { text-align: center; margin: 0; }
.ui-resizable-ghost { border: 1px dotted gray; }

JavaScript

$("#resizable").resizable({ ghost: true }).draggable({ handle:'h3' });