当前位置:网站首页>Native js implements mouse following to display floating box information
Native js implements mouse following to display floating box information
2022-08-06 08:25:00 【The wind elegant】
The effect to be achieved:

The code is as follows:
html part: (defined class name: one-zkfb)

0
Mean value of first-level branch line impedance
js part:
var x = 10;var y = 20;// Mean value of first-level branch line impedance Hover information$('div.one-zkfb').mouseover(function (e) {console.log(e) // The printed element e contains relevant information after the mouse is moved in$('body').append('' +''+"
"+'' + '');// Every time the mouse moves in, first set the data to null$('.max').text('')$('.min').text('')$('.max').text('Maximum value: '+parent.data.statisticData.avgFirstBranch.maxValue +'mΩ')$('.min').text('Minimum: '+parent.data.statisticData.avgFirstBranch.minValue +'mΩ')$('#mytitle').css({'left': (e.pageX + x + 'px'),'top': (e.pageY + y - 80 + 'px')}).show();}).mouseout(function () {// mouse out event, remove dom element$('#mytitle').remove();}).mousemove(function (e) {// mouse over event$('#mytitle').css({'left': (e.pageX + x +10 + 'px'),'top': (e.pageY + y - 20 + 'px')}).show();})The css code is also shown here:
#mytitle {width: 130px;height: 80px;position: absolute;color: #000;max-width: 160px;font-size: 14px;padding: 4px;border: solid 1px #ced5d3;border-radius:10px !important;text-align: center;line-height: 30px;background-color: #fff;box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);}边栏推荐
猜你喜欢

I set the global mapping table prefix in yml, but the database does not recognize it

Chapter 13 Bayesian Network Practice

Check the inverse relationship between the shift distance and the number of iterations

90%的软件测试从业者,努力的方向都错了...你呢?

Simulate the realization of strcpy function (including multiple optimization ideas)

UNIX environment advanced programming - the first chapter

JMeter代理录制手机app

交换综合实验(待补充)

字节跳动最爱问的智力题总结

Button can only be clicked once
随机推荐
JMeter集合点
LeetCode——345. 反转字符串中的元音字母
禁止运行游戏的程序开发
No, no, no, it's 2022, you don't know the principle of Jmeter, right?
全屏数字预加载动画
Leetcode77. 组合
华为外包测试2年,不甘被替换,168天的学习转岗成正式员工
【基于simulink的二阶电路仿真】
yum offline installation
Why do interviewers keep asking technical questions on your resume until they can't answer them?
用C写小游戏(扫雷)
TiDB | 来说说TiEM初体验吧
软件测试八款优秀的API安全测试工具,会用三款工作效率能提升50%
EsgynDB Troubleshooting - nic MTU lead to the failure across a network segment to access the database
Button can only be clicked once
Typescript variable
中国电子学会青少年等级考试五级原题
字节跳动最爱问的智力题总结
读书笔记(二)——《被讨厌的勇气》
js simulates the function of dynamically deleting messages