jQuery draggable

DEMO:
Descript: 嘗試製作 Drag 功能才發現,原來 jQuery 有個好用的 function , offset ,jQuery 官方網站的說明如下,
The .offset() method allows us to retrieve the current position of an element relative to the document. Contrast this with .position(), which retrieves the current position relative to the offset parent. When positioning a new element on top of an existing one for global manipulation (in particular, for implementing drag-and-drop), .offset() is more useful.

留言