draggable可以拖动,不过,不能记忆.
查了下,在so上找到了这个.
http://stackoverflow.com/questions/1328249/remembering-a-jquery-draggable-tool-palette-position-between-page-refreshes
用cookie的方法来保存拖动的位置.
当然,就是要记忆.按照分类法:
远程数据库里 || 或者本地.
本地,又可以分为,cookie和 html5存储.
html5存储分两类,storage和数据库
storage又分两类. sessionStorage和 localStorage.
纯粹是梳理下内容.这个划分的很开了.不过,最普遍还是cookie.
$('#palette') .css({ top: readCookie("palletteY")*1, left: readCookie("palletteX")*1 }) .draggable({ stop: function (event, ui) { createCookie("palletteX", ui.position.left, 100); createCookie("palletteY", ui.position.top, 100); } }); 不过上面的方法不能用.主要用下面的.加了jquery+cookie插件.其实就是个简单的封装.找不到就自己写吧,嗯嗯. $('#palette') .css({ top: $.cookie("palletteY")*1, left: $.cookie("palletteX")*1 }) .draggable({ stop: function (event, ui) { $.cookie("palletteX", ui.position.left); $.Cookie("palletteY", ui.position.top); } });