从网上找了一个很漂亮的许愿墙模板,早上就花了一段时间写了这个许愿墙程序,给大家分享下。
首先我们遍历出所有的许愿列表:$query = mysql_query("select * from wishing_wall order by id desc limit 0, 50"); <br>
while ($row = mysql_fetch_array($query)) { <br>
list($left, $top, $zindex) = explode('|', $row['xyz']); <br>
$time = strtotime($row['addtime']); <br>
<br>
$notes .= "<dl> <br>
<dt>
<span>" . $row['name'] . "</span><span>" . $row['id'] . "</span>
</dt> <br>
<dd>" . $row['content'] . "</dd> <br>
<dd>
<span>" . tranTime($time) . "</span><a></a>
</dd> <br>
</dl>";
接着我们把许愿列表放到.container里面:<div> <br>
<?php echo $notes; ?> <br>
</div>
通过jQueryUI拖动许愿墙悬浮层代码如下:var zIndex = 0; <br>
function make_draggable(elements) { <br>
elements.draggable({ <br>
handle: 'dt', //拖动把手 <br>
opacity: 0.8, <br>
containment: 'parent', //拖动范围 <br>
start: function(e, ui) { <br>
ui.helper.css('z-index', ++zIndex) <br>
}, <br>
stop: function(e, ui) { <br>
$.get('ajax.php?act=update_position', { <br>
x: ui.position.left, <br>
y: ui.position.top, <br>
z: zIndex, <br>
id: parseInt(ui.helper.attr("data-id")) <br>
}); <br>
} <br>
}); <br>
}
PHP保存位置:$act = htmlspecialchars($_GET['act']); <br>
if ($act == 'update_position') { <br>
if (!is_numeric($_GET['id']) || !is_numeric($_GET['x']) || !is_numeric($_GET['y']) || !is_numeric($_GET['z'])) <br>
die("0"); <br>
<br>
$id = intval($_GET['id']); <br>
$x = intval($_GET['x']); <br>
$y = intval($_GET['y']); <br>
$z = intval($_GET['z']); <br>
<br>
mysql_query("UPDATE wishing_wall SET xyz='" . $x . "|" . $y . "|" . $z . "' WHERE id=" . $id); <br>
<br>
echo "1"; <br>
}
许愿墙演示:http://www.sucaihuo.com/php/136.html
许愿墙表单表情尚未做,请关注许愿墙代码后面的更新。
PHP+jQuery+Ajax漂亮的许愿墙效果.zip
( 239.97 KB 下载:137 次 )
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment