Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery resizable snap to other resizable objects' borders?

I wonder why they didn't develope JQuery resizable with option to snap the resizing object to others (instead of snapping to grid) like draggable ? Does anyone know such a plugin to achieve this ? Thanks.

like image 806
vantrung -cuncon Avatar asked Sep 22 '11 09:09

vantrung -cuncon


2 Answers

Think this should do the trick:

https://github.com/polomoshnov/jQuery-UI-Resizable-Snap-extension

like image 100
leo.vingi Avatar answered Nov 10 '22 11:11

leo.vingi


For me this javascript add-on provided didn't work, maybe because it's some years outdated. Instead I found a simpliest solution that uses only an original attribute from the JQuery-UI's library.

On the dialog you want to snap, just make something like:

$('.your-dialog-filter').dialog().parents('.ui-dialog').draggable('option', 'snap', true);

Simple like this.

More info and demo: https://jqueryui.com/draggable/#snap-to

like image 40
digofreitas Avatar answered Nov 10 '22 10:11

digofreitas