Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

modify contents of div while dragging with jquery ui draggable

I have a draggable div (jquery ui draggable) which contains mainly text. Can I change the contents of the div while dragging?

(actually, I want to make it a smaller and nicer div)

like image 748
xpanta Avatar asked Dec 27 '22 23:12

xpanta


1 Answers

Try this out: http://jsfiddle.net/6JtMp/

Here's the code:

<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 -->
like image 168
Fareesh Vijayarangam Avatar answered Apr 09 '23 19:04

Fareesh Vijayarangam