How can I make an element draggable and resizable in jquery?

How can I make an element draggable and resizable in jquery?

+3
source share
3 answers

both draggable and resizable support chaining mode, so you can simplify the code in one line.
Say you have a div and the id of that div is the title you want to make it draggable and resizable.then jquery will work like this ....

$(document).ready(function() {

    $("#header").draggable().resizable();
 });

see the demo here ... DEMO
refer to this manual for more information .... Drag and Drop

+7
source

Besides using jQuery, you also need to use jQuery UI http://jqueryui.com/demos/ .

jQuery UI , . , Draggable Resizable (, Droppable , ).

: Draggable Resizable:

$(document).ready(function() {

    $(".elements").draggable().resizable();
 });
+3

this is original

// this will make <div id="box"> resizable and draggable 
$('#box').resizable().parent().draggable(); 

// same but slightly safer since it checks parent class 
$('#box').resizable().parent('.ui-wrapper').draggable(); 
+3
source

Source: https://habr.com/ru/post/1788408/


All Articles