如何添加判断鼠标不在图标栏上自动消失的功能
How to add a function to judge that the mouse does not over the icon bar that it disappears automatically
如何添加判断鼠标不在图标栏上自动消失的功能
在 Tampermonkey 中,我使用了我在 Greasyfork 中找到的 JavaScript,当我在网站上输入 select 个词时它会弹出。
我想实现当鼠标移到图标栏上时,图标栏不会消失,如果我不这样做或移出鼠标,图标栏会自动消失。
我用了mouseIn、mouseOver函数,都没有用,请帮帮我。
Greasyfork中的总代码:
The browser search tool
判断鼠标不在图标栏上的函数:
mouseIn: 0;
var TimeOutHide = function () {
if (mouseIn === 0) {
return icon.style.display = 'none';
}
};
图标条码(部分):
var iconArray = [
{
name: 'Open link',
image: 'https://i.ibb.co/PQ5xM2R/2-1.png',
host: [''],
popup: function (text) {
if(text.indexOf("http://")==0||text.indexOf("https://")==0)
window.open(text, "_blank");
else window.open("http://"+text, "_blank");
}
},
]
图标栏自动消失当我select字:
timer = window.setTimeout(TimeOutHide, 6000);
完成了。
添加两个函数:
icon.onmouseleave = function(){
}
icon.onmouseenter = function(){
}
使用'if'判断定时器,然后清除定时器
clearTimeout(timer);
如何添加判断鼠标不在图标栏上自动消失的功能
在 Tampermonkey 中,我使用了我在 Greasyfork 中找到的 JavaScript,当我在网站上输入 select 个词时它会弹出。
我想实现当鼠标移到图标栏上时,图标栏不会消失,如果我不这样做或移出鼠标,图标栏会自动消失。
我用了mouseIn、mouseOver函数,都没有用,请帮帮我。
Greasyfork中的总代码:
The browser search tool
判断鼠标不在图标栏上的函数:
mouseIn: 0;
var TimeOutHide = function () {
if (mouseIn === 0) {
return icon.style.display = 'none';
}
};
图标条码(部分):
var iconArray = [
{
name: 'Open link',
image: 'https://i.ibb.co/PQ5xM2R/2-1.png',
host: [''],
popup: function (text) {
if(text.indexOf("http://")==0||text.indexOf("https://")==0)
window.open(text, "_blank");
else window.open("http://"+text, "_blank");
}
},
]
图标栏自动消失当我select字:
timer = window.setTimeout(TimeOutHide, 6000);
完成了。
添加两个函数:
icon.onmouseleave = function(){
}
icon.onmouseenter = function(){
}
使用'if'判断定时器,然后清除定时器
clearTimeout(timer);