更改字體的大小javascript
var size = Math.random() * 10 + 8 + "px"; 如今是字體大小隨機,想要固定大小本身修改成固定px便可
更改字體顏色css
let r = Math.random()*255; let g = Math.random()*255; let b = Math.random()*255; var color = "rgb("+r+","+g+","+b+")"; 1>>直接改成固定的顏色
更改點擊內容java
var a = new Array("global", "yield", "python", "HTML", "css", "javascript", "lambda" ,"import", "print", "class", "def", "except","assert", "exec", "pass", "False", "True", "socket", "struct" ,"random", "PEP8", "threading", "multiprocessing");
將代碼粘貼到側邊欄或者頁首或者頁尾處python
<script type="text/javascript"> $(document).ready(function(){ var a_index = 0; $("body").click(function(e){ let r = Math.random()*255; let g = Math.random()*255; let b = Math.random()*255; var color = "rgb("+r+","+g+","+b+")"; var a = new Array("global", "yield", "python", "HTML", "css", "javascript", "lambda" ,"import", "print", "class", "def", "except","assert", "exec", "pass", "False", "True", "socket", "struct" ,"random", "PEP8", "threading", "multiprocessing"); var $i = $("<span/>").text(a[a_index]); a_index = (a_index + 1) % a.length; var x = e.pageX,y = e.pageY; var size = Math.random() * 10 + 8 + "px"; $i.css({ "z-index": 99999, "top": y - 20, "left": x, "position": "absolute", "font-weight": "400", "font-size": size, "color": color }); $("body").append($i); $i.animate({"top": y-200,"opacity": 0},1500,function() { $i.remove(); }); }); }); </script>