Skip to content

Commit

Permalink
Fix for #4153 (#4253)
Browse files Browse the repository at this point in the history
* fix for #4153

* only load touch/mouse events for touch/mouse devices

* undid formating changes

* undid more formating changes

* undid all formating changes

* use pointerover and pointerout eventlisteners
  • Loading branch information
maxi4329 authored and DedeHai committed Feb 15, 2025
1 parent 2ac4d03 commit edc6022
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions wled00/data/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function isI(n) { return n === +n && n === (n|0); } // isInteger
function toggle(el) { gId(el).classList.toggle("hide"); gId('No'+el).classList.toggle("hide"); }
function tooltip(cont=null) {
d.querySelectorAll((cont?cont+" ":"")+"[title]").forEach((element)=>{
element.addEventListener("mouseover", ()=>{
element.addEventListener("pointerover", ()=>{
// save title
element.setAttribute("data-title", element.getAttribute("title"));
const tooltip = d.createElement("span");
Expand All @@ -41,7 +41,7 @@ function tooltip(cont=null) {
tooltip.classList.add("visible");
});

element.addEventListener("mouseout", ()=>{
element.addEventListener("pointerout", ()=>{
d.querySelectorAll('.tooltip').forEach((tooltip)=>{
tooltip.classList.remove("visible");
d.body.removeChild(tooltip);
Expand Down
7 changes: 3 additions & 4 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3114,10 +3114,9 @@ function mergeDeep(target, ...sources)
return mergeDeep(target, ...sources);
}

function tooltip(cont=null)
{
function tooltip(cont=null) {
d.querySelectorAll((cont?cont+" ":"")+"[title]").forEach((element)=>{
element.addEventListener("mouseover", ()=>{
element.addEventListener("pointerover", ()=>{
// save title
element.setAttribute("data-title", element.getAttribute("title"));
const tooltip = d.createElement("span");
Expand All @@ -3142,7 +3141,7 @@ function tooltip(cont=null)
tooltip.classList.add("visible");
});

element.addEventListener("mouseout", ()=>{
element.addEventListener("pointerout", ()=>{
d.querySelectorAll('.tooltip').forEach((tooltip)=>{
tooltip.classList.remove("visible");
d.body.removeChild(tooltip);
Expand Down

0 comments on commit edc6022

Please sign in to comment.