开发者

JQuery: Drag and Drop Set positions

开发者 https://www.devze.com 2023-03-08 01:58 出处:网络
I\'m using the jquery drag and drop functionality as seen on bbc.com and google. Just wondering, does anyone know how to set the postions of the controls? So, for example, the user drags and drops the

I'm using the jquery drag and drop functionality as seen on bbc.com and google. Just wondering, does anyone know how to set the postions of the controls? So, for example, the user drags and drops the control开发者_StackOverflow中文版, the positions are saved. Page refreshes it should stay in the same place. I have tried using:

     $("#widget").offset({ top: 10, left: 30 });

with no joy. It simple doesn't do anything.

Anyone have any suggestions? cheers


i think if you want to save the position you have to save it inside a cookie

try something with http://plugins.jquery.com/project/Cookie


$(#widget).draggable({revert:true, helper:"clone"});

using this your Dom will set itself to its default position whenever drag is released.

and about setting the dom into its default position on refresh i think ur default css would take care of that on refresh...

refer this link for details

0

精彩评论

暂无评论...
验证码 换一张
取 消