javascript - 悬停时特殊光标更改
问题描述
我有一个函数可以创建一个大圆圈,只有当光标悬停在 QrCide__Section 时才想激活它……我对编码还很陌生。我认为使用mouseover
可能有效,但我们可以将事件堆叠在一起吗?
我包含了这部分的所有必要代码。
html:
<div class="QrCode__Section">
<div class="cursor"></div>
<div class="QrCode__Img">
<h3>Find the QR code for the spotify playlist</h3>
<div id="qrcode">
<img id="QRCode" src="img/qr-code.png" alt="">
</div>
</div>
</div>
CSS:
.cursor {
position: absolute;
width: 250px;
height: 250px;
top: -50%;
left: -50%;
margin: -125px 0 0 -125px;
border-radius: 50%;
background-color: white;
transition: transform 0.8s ease-out;
mix-blend-mode: difference;
filter: grayscale(2);
pointer-events: none;
}
.cursor.is-moving {
transform: scale (0.8);
}
JS:
var $cursor = $('.cursor');
function moveCursor(e) {
$cursor.addClass('is-moving');
$cursor.css({"top": e.pageY, "left": e.pageX});
clearTimeout(timer2);
var timer2 = setTimeout(function() {
$cursor.removeClass('is-moving');
}, 300);
}
$(window).on('mousemove', moveCursor);
解决方案
推荐阅读
- c# - C# 安装向导不安装我所有的项目需要的文件
- javascript - React material-ui:如何映射所有图标?
- javascript - 比较日期谷歌表格脚本
- java - Java - 如何根据第三个列表合并 2 个列表?
- string - 字符数有限的字符串变量
- ios - 我在objective-c中有一个ios项目我遇到了一些错误,比如找不到PubNub/PubNub.h'文件和更多文件
- angular - 如何修复拒绝在框架中显示,因为它将“X-Frame-Options”设置为“拒绝”
- javascript - 如何在 react-native 中分别渲染 2 个幻灯片组件
- javascript - 研究:如何获取浏览器中配置的默认字体大小
- python - Pandas 为 B 列中的每个唯一值获取 A 列中唯一值的列表