今天给一个管理系统的做桌面,桌面采用win风格的磁吸式贴片,图层可以拖动,更换位置。这个很容易实现,很多代码都有。但是我要实现的是将图层的顺序写入数据库,以便下次访问的时候能从数据库读取出来。
试了几个方案都不行,后来发现使用JqueryUI就轻松实现了。
代码如下:
要引入jquery库和jqueryUI库。
<!DOCTYPE HTML>
<html>
<head>
<style>
.item_content ul {
list-style:none;
text-align:center;
}
.item_content ul li {
width:200px;
height:200px;
float:left;
margin:5px
}
.item_content {
width:100%;
height:100%;
border:0px solid #ccc;
margin:0;
padding-bottom:10px;
background:#636;
padding:0;
text-align:center;
}
.item_content .item {
width:200px;
height:200px;
line-height:200px;
text-align:center;
cursor:pointer;
background:#F60;
float:left;
}
.item_content .item img {
width:200px;
height:200px;
border-radius:4px;
}
</style>
<title>我的桌面</title>
</head>
<body>
<div class="page-container" style="padding:0;margin