Snap-):
JQuery ("# draggable1"). draggable ({snap: true });//Default, adsorption in any way
JQuery ("# draggable2"). draggable ({snap: "# snaptarget "});//Adsorption with the inner and outer diameter of an element
JQuery ("# draggable3"). draggable ({snap: "# snaptarget", snapMode: "outer "});//Adsorption with the outer diameter of an element. The adsorption method is as follows: local upper absorption, local lower absorption
JQuery ("# draggable4"). draggable ({grid: [20, 20]}); //Move at a certain distance
JQuery ("# draggable5"). draggable ({grid: [80, 80]});
Source code-html code:
<Html>
PS: For jQuery ("# draggable3 "). draggable ({snap: "# snaptarget", snapMode: "outer"}); // adsorption with the outer diameter of an element. Adsorption Method: upper part of the element, what I understand in this article: id
It is the outer diameter adsorption of the container whose id is "snaptarget" for draggable3. That is, draggable3 is on snaptarget.
The bottom border of draggable3 and the top border of snaptarget are adsorbed. When draggable3 is under snaptarget
The bottom border of the box and snaptarget is adsorbed.