Answers for "how do I call the position of a draggable object"

0

how do I call the position of a draggable object

<script>
$(function() {
    $('#draggable').draggable({
        drag: function() {
            var offset = $(this).offset();
            var xPos = offset.left;
            var yPos = offset.top;
            $(this).text('x: ' + xPos + 'y: ' + yPos);
        }
    });

    $("#droppable").droppable({
        drop: function(event, ui) {
            $(this)
                .addClass("ui-state-highlight")
                .find("p")
                .html("Dropped!");
        }
    });
});
</script>
Posted by: Guest on October-25-2020

Code answers related to "how do I call the position of a draggable object"

Browse Popular Code Answers by Language