没有合适的资源?快使用搜索试试~ 我知道了~
Jquery拖拽并简单保存的实现代码
0 下载量 45 浏览量
2020-12-10
20:51:22
上传
评论
收藏 31KB PDF 举报
温馨提示
试读
2页
但是如何保存顺序呢,想到了cookie,但是用如何用cookie保存顺序呢,直接保存html代码下次读取覆盖可以,但是总感觉内容多的话 保存的东西比较多,后用ui插件获取id保存id在读取实现了顺序的保存,废话不多说..直接看代码… 代码如下:<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat
资源详情
资源评论
资源推荐
Jquery拖拽并简单保存的实现代码拖拽并简单保存的实现代码
但是如何保存顺序呢,想到了cookie,但是用如何用cookie保存顺序呢,直接保存html代码下次读取覆盖可以,但是总感觉内
容多的话 保存的东西比较多,后用ui插件获取id保存id在读取实现了顺序的保存,废话不多说..直接看代码…
代码如下:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<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”);
}
}
});
weixin_38665490
- 粉丝: 4
- 资源: 985
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0