Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn. I have found a very beautiful wishing wall template on the Internet. In the morning, I spent some time writing this wishing wall program, share with you.
First, we traverse all the wishing lists:
$query = mysql_query("select * from wishing_wall order by id desc limit 0, 50");
while ($row = mysql_fetch_array($query)) {
list($left, $top, $zindex) = explode('|', $row['xyz']);
$time = strtotime($row['addtime']);
$notes .= "
-
" . $row['name'] . "" . $row['id'] . "
-
" . $row['content'] . "
-
" . tranTime($time) . "
";
Then we put the wishing list in. container:
The code for dragging the suspension layer of the wishing wall through jQueryUI is as follows:
Var zIndex = 0;
Function make_draggable (elements ){
Elements. draggable ({
Handle: 'dt', // drag the handle
Opacity: 0.8,
Containment: 'parent', // drag range
Start: function (e, ui ){
Ui.helper.css ('z-Index', ++ zIndex)
},
Stop: function (e, ui ){
$. Get ('ajax. php? Act = update_position ',{
X: ui. position. left,
Y: ui. position. top,
Z: zIndex,
Id: parseInt (ui. helper. attr ("data-id "))
});
}
});
}
PHP storage location:
$act = htmlspecialchars($_GET['act']);
if ($act == 'update_position') {
if (!is_numeric($_GET['id']) || !is_numeric($_GET['x']) || !is_numeric($_GET['y']) || !is_numeric($_GET['z']))
die("0");
$id = intval($_GET['id']);
$x = intval($_GET['x']);
$y = intval($_GET['y']);
$z = intval($_GET['z']);
mysql_query("UPDATE wishing_wall SET xyz='" . $x . "|" . $y . "|" . $z . "' WHERE id=" . $id);
echo "1";
}
Wishing wall demonstration: Http://www.sucaihuo.com/php/136.html
The expression of the wishing wall form has not been done yet. Please follow the updates behind the wishing wall code.
Php?jquery=ajaxbeautiful wishing fruit .zip (239.97 KB download: 137 times)
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB