English 中文(简体)
在 JqueryUI 中可拖动和可变换的图像无效吗?
原标题:Draggable and resizable in JqueryUI for an image is not working?

我用下面的代码 拖动和调整图像大小,

<!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>

可变的功能是可变的 。 但是拖曳图像无效 。 如果我申请 div 结构的话

<div id="img_content" class="ui-widget-content">
        <p>Drag me around</p>
    </div>

它的工作罚款。

我如何执行图像标记的拖放和调整大小?

问题回答

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

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.





相关问题
Using jQuery Plugins with Wordpress

Having a bit of trouble using jQuery plugins (Superfish, jQuery UI, etc) using Wordpress. Everything works fine in my plain non-Wordpress site, but Wordpress seems to conflict with JQuery. There must ...

Jquery TableSorter 2.0 - Revert Sort order

All, I am using the JQuery TableSorter Plugin. The table sorts fine for the selected columns. Consider that when the page loads, there is no sorting taking place. Now, if the table is sorted by one ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

热门标签