jquery 点击页面流畅弹出预定文字
js代码:
1 <script src="https://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script> 2 <script type="text/javascript"> 3 var a_idx = 0; 4 $(document).ready(function ($) { 5 $("body").click(function (e) { 6 var a = new Array("富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"); 7 var $i = $("<span/>").text(a[a_idx]); 8 a_idx = (a_idx + 1) % a.length; 9 var x = e.pageX, 10 y = e.pageY; 11 $i.css({ 12 "z-index": 999999999999999999999999999999999999999999999999999999999999999999999, 13 "top": y - 20, 14 "left": x, 15 "position": "absolute", 16 "font-weight": "bold", 17 "color": "#ff6651" 18 }); 19 $("body").append($i); 20 $i.animate({ 21 "top": y - 180, 22 "opacity": 0 23 }, 1500, function () { 24 $i.remove(); 25 }); 26 }); 27 }); 28 </script>
欢迎体验由我个人开发的高颜值云开发工具小程序
![](https://img2018.cnblogs.com/blog/1324387/201905/1324387-20190524134827292-1343993864.png)