我有一个可拖动的div(jquery uidraggable),其中主要包含文本。我可以在拖动时更改 div 的内容吗?
(实际上,我想让它成为一个更小、更好的div)
最佳答案
试试这个:http://jsfiddle.net/6JtMp/
代码如下:
<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; background-color: green; }
</style>
<script>
$(function() {
$( "#draggable" ).draggable({
start: function(event, ui) { $(this).css("height",10); },
stop: function(event, ui) { $(this).css("height",150); }
});
});
</script>
<div class="demo">
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
</div><!-- End demo -->
关于jquery - 使用jquery uidraggable拖动时修改div的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5411209/