给网站增”富强、明主…”点击特效,颜色随机

  • 5
  • 5,924 ℃
  • A+
所属分类:网站建设

在主题页脚 footer.php文件中进行修改 就是一个js脚本 增加如下代码

<script type="text/javascript">
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正" ,"法治", "爱国", "敬业", "诚信", "友善");
var $i = $("<span/>").text(a[a_idx]);
a_idx = (a_idx + 1) % a.length;
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index":5,
"top": y - 20,
"left": x,
"position": "absolute",
"font-weight": "bolder",
"color": random()
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
3000,
function() {
$i.remove();
});
});
setTimeout('delay()', 2000);
});
function delay() {
$(".buryit").removeAttr("onclick");
}

function random() {
return "rgb(" + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + ")"
}
</script>

给网站增
zore

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:5   其中:访客  0   博主  0

    • avatar 华中大佬 0

      牛批,加油

      • avatar zore 博主

        嗯嗯 慢慢优化嘻嘻

        • avatar 汪小鸟 1

          666学到了

            • avatar zore 博主

              @汪小鸟 可以加波收藏 嘿嘿