jquery drag and simple Save implementation Code _jquery

Source: Internet
Author: User
But how do you save the order, think of cookies, but how to save the order with cookies, directly save the HTML code next read cover can, but the total feeling content more words to save more things, and then use the UI plugin to get ID save ID in the reading to achieve the order of save, nonsense not to say more. Look directly at the code ...

Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<style type= "Text/css" >
Div
{
border:1px solid red;
}
#myList
{
padding-top:20px;
width:500px;
Background: #EEE;
List-style-type:none;
}
#myList Li
{
height:30px;
Cursor:pointer;
margin:20px;
BORDER:1PX solid blue;
}
#myList A
{
Text-decoration:none;
Color: #0077B0;
}
#myList a:hover
{
Text-decoration:underline;
}
#myList. QLink
{
font-size:12px;
Color: #666;
margin-left:10px;
}
</style>
<script src= "Jquery-1.3.2.min.js" type= "Text/javascript" ></script>
<script src= "Ui.core.js" type= "Text/javascript" ></script>
<script src= "Ui.sortable.js" type= "Text/javascript" ></script>
<script src= "Cookie.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >
$ (function () {
$ ("#myList"). Sortable ({delay:1, Containment: "Div", Connectwith: ". Otherlist", Stop:function () {
Alert ($ ("#myList"). Sortable ("serialize");
Alert ($ ("#myList"). Sortable ("ToArray");
$.cookie ("MyCookie", $ ("#myList"). Sortable (' ToArray '), {expires:7})
}
});
$ (". QLink"). Click (function () {
alert (this.classname);
});
if ($.cookie ("MyCookie")) {
var ids = $.cookie ("MyCookie"). Split (",");
for (var i = 0; i < ids.length; i++) {
$ ("#" + ids[i]). Appendto ("#myList");
}
}
});
</script>
<body>
<div>
<ul id= "MyList" >
<li id= "Mylist_mood" ><a href= "#" > Mood </a> </li>
<li id= "Mylist_photo" ><a href= "#" > Album </a> <a href= "#" class= "QLink" > Upload </a> </li>
<li id= "Mylist_blog" ><a href= "#" > Log </a> <a href= "#" class= "QLink" > Release </a> </li>
<li id= "Mylist_vote" ><a href= "#" > Polling </a> </li>
<li id= "mylist_shate" ><a href= "#" > Share </a> </li>
<li id= "Mylist_group" ><a href= "#" > Group </a> </li>
</ul>
</div>
</body>

Oh.. This saw the effect of the lack of hope master enlighten ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.