当前位置:网站首页>Special effects - click the mouse and the randomly set text will appear
Special effects - click the mouse and the randomly set text will appear
2022-07-24 06:39:00 【Jie_ one thousand nine hundred and ninety-seven】
Mouse click , Randomly set text appears
One . design sketch

Two . Implementation code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title> Click the mouse to display the randomly set text </title>
</head>
<body>
<script> (function() {
var a_idx = 0; window.onclick = function(event) {
var a = new Array( " Rich and strong (powerful) ", " democracy ", " civilization ", " harmonious ", " free ", " equality ", " justice ", " The rule of law ", " patriotic ", " dedicated ", " The good faith ", " friendly " ); var dom = document.createElement("b"); // establish b Elements dom.onselectstart = new Function("event.returnValue=false"); // Prevent dragging document.body.appendChild(dom).innerHTML = a[a_idx]; // take b Add elements to the page a_idx = (a_idx + 1) % a.length; dom.style.cssText = "position: fixed;left:-100%;"; // to p Element set style var f = 16, // font size x = event.clientX - f / 2, // Abscissa y = event.clientY - f, // Ordinate c = randomColor(), // Random color a = 1, // transparency s = 1.2; // Zoom in and out var timer = setInterval(function() {
// Add timers if (a <= 0) {
document.body.removeChild(dom); clearInterval(timer); } else {
dom.style.cssText = "font-size:16px;cursor: default;position: fixed;color:" + c + ";left:" + x + "px;top:" + y + "px;opacity:" + a + ";transform:scale(" + s + ");"; y--; a -= 0.016; s += 0.002; } }, 15); }; // Random color function randomColor() {
return ( "rgb(" + ~~(Math.random() * 255) + "," + ~~(Math.random() * 255) + "," + ~~(Math.random() * 255) + ")" ); } })(); </script>
</body>
</html>
边栏推荐
- Customize ZABBIX agent RPM package
- rsync(一):基本命令和用法
- Difference between PX and EM and REM
- [251] common test tools
- Li Kou 986. Intersection of interval lists
- CentOS operating system security reinforcement
- JS: why [] = =! [] return true?
- PXE technology network installation
- 【小型物体测速仪】只有原理,无代码
- Secondary processing of template data
猜你喜欢

深入了解MySQL 两把锁啥时候用(表锁,行锁)

Experiment: disk quota operation

Polkadot | interprets how liberty plan, which subverts traditional social media, will be launched in Poka

Talk about strong cache and negotiation cache

Jenkins automated unattended operation (up / down)

SSH Remote Access and control

NFS共享服务及实验

Animation effect

进程和计划任务管理

Server hardware and RAID configuration practice
随机推荐
mysql 忘记退出直接关闭窗口现在要删除整个文件夹如何删除
Experiment: disk quota operation
进行挂载永久挂载后无法开机
Write blog at leisure ~ briefly talk about let, VaR and Const
awk的使用
Windows下Mysql5.7忘记root密码解决方法
Summary of common working methods (7S, SWOT analysis, PDCA cycle, smart principle, 6w2h, time management, WBS, 28 principles)
Wasm vs EVM, Boca's choice predicts the future of the public chain
Customize ZABBIX agent RPM package
手动安装Apache
Talk about strong cache and negotiation cache
自定义zabbix agent rpm包
MySQL Index & execution plan
Yiwen node installation, download and configuration
FTP服务与实验
Life warning Maxim
Speed pointer in JS linked list
Flink function (2): checkpointedfunction
DHCP原理与配置
Playing RTSP video stream on webpage