问题
I used below code for dragging and resizing the image,
<!DOCTYPE html>
<html>
<head lang="en">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
<script type="text/javascript">
$(document).ready(function() {
$( "#img_content" ).draggable().resizable();
});
</script>
</head>
<body class='default'>
<div class="demo">
<!--<div id="img_content" class="ui-widget-content">
<p>Drag me around</p>
</div>-->
<img id="img_content" class="ui-widget-content" src="Tulips.jpg" />
</div>
</body>
</html>
resizable is working corretly. but dragging the image not working. if i applied for div structure
<div id="img_content" class="ui-widget-content">
<p>Drag me around</p>
</div>
its working fine.
How do i implement drag and resize for image tag?
回答1:
You should wrap the image into a div with style="display:inline-block;
and then make the div draggable and the image resizable.
Working Example
回答2:
The solution I've found was resizing/making dragable a with a background image. I guess that the element is not draggable and resizable. Well, it works for me. Bye.
来源:https://stackoverflow.com/questions/10703450/draggable-and-resizable-in-jqueryui-for-an-image-is-not-working