Skip to content

Commit c7e1b47

Browse files
committed
display tooltip on slider value change
1 parent b25e22b commit c7e1b47

File tree

2 files changed

+2170
-2121
lines changed

2 files changed

+2170
-2121
lines changed

wled00/data/index.htm

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,21 @@
441441
z-index: -1;
442442
}
443443

444+
.sliderbubble {
445+
width: 30px;
446+
line-height: 24px;
447+
background: var(--c-3);
448+
position: absolute;
449+
transform: translateX(-50%);
450+
border-radius: 6px;
451+
margin-left: 10px;
452+
display: inline;
453+
}
454+
455+
.hidden {
456+
display: none;
457+
}
458+
444459
input[type=range] {
445460
-webkit-appearance: none;
446461
width: 220px;
@@ -480,6 +495,10 @@
480495
background: var(--c-f);
481496
transform: translateY(7px);
482497
}
498+
input[type=range]:active + .sliderbubble {
499+
display: inline;
500+
transform: translateX(-50%);
501+
}
483502

484503
#wwrap {
485504
display: none;
@@ -1002,6 +1021,7 @@
10021021
<i class="icons slider-icon">&#xe325;</i>
10031022
<div class="sliderwrap il">
10041023
<input id="sliderSpeed" class="noslide" onchange="setSpeed()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
1024+
<output class="sliderbubble hidden"></output>
10051025
<div class="sliderdisplay"></div>
10061026
</div>
10071027
</div>
@@ -1010,6 +1030,7 @@
10101030
<i class="icons slider-icon" onclick="tglLabels()">&#xe409;</i>
10111031
<div class="sliderwrap il">
10121032
<input id="sliderIntensity" class="noslide" onchange="setIntensity()" oninput="updateTrail(this)" max="255" min="0" type="range" value="128" />
1033+
<output class="sliderbubble hidden"></output>
10131034
<div class="sliderdisplay"></div>
10141035
</div>
10151036
</div>
@@ -1298,6 +1319,13 @@
12981319
size();
12991320
d.getElementById("cv").style.opacity=0;
13001321
if (localStorage.getItem('pcm') == "true") togglePcMode(true);
1322+
var sls = d.querySelectorAll('input[type="range"]');
1323+
for (var sl of sls) {
1324+
sl.addEventListener('input', updateBubble, true);
1325+
sl.addEventListener('touchstart', toggleBubble);
1326+
sl.addEventListener('touchend', toggleBubble);
1327+
}
1328+
13011329
}
13021330

13031331
function updateTablinks(tabI)
@@ -1677,6 +1705,21 @@
16771705
e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = val;
16781706
}
16791707

1708+
function updateBubble(e)
1709+
{
1710+
var bubble = e.target.parentNode.getElementsByTagName('output')[0]
1711+
var max = e.target.hasAttribute('max') ? e.target.attributes.max.value : 255;
1712+
1713+
if (bubble) {
1714+
bubble.innerHTML = e.target.value
1715+
}
1716+
}
1717+
1718+
function toggleBubble(e)
1719+
{
1720+
e.target.parentNode.querySelector('output').classList.toggle('hidden');
1721+
}
1722+
16801723
function updateLen(s)
16811724
{
16821725
if (!d.getElementById(`seg${s}s`)) return;

0 commit comments

Comments
 (0)