Drag / Rotate / Resize JQUERY
Drag / Rotate / Resize JQUERY
by Arun_pandian_k
HTML
<script src="//raw.githubusercontent.com/ilyavolodin/jquery-ui-extras/master/jquery.ui.rotatable.js"></script>
<div class="draggable rot">
<div class="rotatable">
<div class="resizable">
<img src="http://placehold.it/1500x500/fcc111/&text=Andrew Pougher" alt="" />
</div>
</div>
</div>
<div class="draggable rot">
<div class="rotatable">
<div class="resizable">
<img src="http://placehold.it/1500x500/fcc111/&text=Andrew Pougher" alt="" />
</div>
</div>
</div>
<div class="draggable rot">
<div class="rotatable">
<div class="resizable">
<p>
<input type="text" value="arun"/>
</p>
</div>
</div>
</div>
CSS
.draggable
{
position: relative;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
zoom: 1;
*display: inline;
cursor: hand;
cursor: pointer;
}
.resizable
{
width: 50%;
border: 1px solid #bb0000;
}
.resizable img
{
width: 100%;
}
.ui-resizable-handle
{
background: #f5dc58;
border: 1px solid #FFF;
width: 9px;
height: 9px;
z-index: 2;
}
.ui-resizable-se
{
right: -5px;
bottom: -5px;
}
.ui-rotatable-handle
{
background: #f5dc58;
border: 1px solid #FFF;
border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
-webkit-border-radius: 5px;
cursor: pointer;
height: 10px;
left: 50%;
margin: 0 0 0 -5px;
position: absolute;
top: -5px;
width: 10px;
}
.ui-rotatable-handle.ui-draggable-dragging
{
visibility: hidden;
}
JavaScript
$('.draggable').draggable();
$('.resizable').resizable({
aspectRatio: true,
handles: 'ne, se, sw, nw'
});
$(document).on('mouseover', '.rot', function(){
var tc = $(this);
tc.rotatable({
handle:tc.children('.rotate.left, .rotate.right')
});
return true;
});