asasass
December 24, 2017, 7:17am
1
When the mouse goes over the circle it changes color, but when it touches the buttons the color changes back. How do I prevent the color from changing back when the mouse touches the buttons?
circle:hover {
stroke: red;
}
.stack {
position: relative;
z-index: 1;
stroke-width: 2;
stroke: green;
fill: transparent;
}
asasass
December 24, 2017, 7:53am
2
This worked:
z-index: 4;
Is this right?
.stack {
position: relative;
z-index: 4;
stroke-width: 2;
stroke: green;
fill: transparent;
}
asasass
December 24, 2017, 7:55am
3
Wait, like this?
Am I doing this right?
circle:hover {
stroke: red;
}
.stack {
position: relative;
z-index: 3;
stroke-width: 2;
stroke: green;
fill: transparent;
}
.linesd::before,
.linesd::after {
content: "";
position: absolute;
z-index: 1;
top: 0;
left: 83px;
width: 3px;
height: 100%;
background: #0059dd;
}
.linesd::after {
left: 174px;
}
.playd,
.paused {
position: absolute;
top: -4px;
right: 0;
bottom: 0;
left: 4px;
margin: auto;
fill: #0059dd;
z-index: 2;
}
.paused {
left: 0;
}
circle:hover {
stroke: red;
}
.stack {
position: relative;
z-index: 3;
stroke-width: 2;
stroke: green;
fill: transparent;
}
asasass
December 24, 2017, 8:26am
4
When I do this, tooltips no longer works on the play/pause buttons.
.stack {
position: relative;
z-index: 3;
stroke-width: 2;
stroke: green;
fill: transparent;
}
circle:hover {
stroke: red;
}
You mean, when you hover on the circle it changes colour, as per the rule you set, and when you cease to hover on the circle (move the mouse over another element) it reverts to its normal colour. That’s how hover works.
Rather than using an svg circle, you could simply add a border to the play button, which would change colour if you hovered anywhere on or inside the border.
asasass
December 24, 2017, 10:15am
9
When it’s set like this the tooltips don’t show for the play/pause buttons.
#4
asasass
December 24, 2017, 10:38am
11
And when it’s like this the hover is broken.
z-index: 1;
#1
You’ve used z-index: 3
on .stack
, placing it in front of the play button.
PaulOB
December 24, 2017, 11:12am
14
Have you tried z-index:0 ?
.playd,
.paused {
position: absolute;
top: -4px;
right: 0;
bottom: 0;
left: 4px;
margin: auto;
fill: #0059dd;
z-index: 0;
}
asasass
December 24, 2017, 11:27am
15
Tooltips still don’t show:
PaulOB
December 24, 2017, 11:31am
16
My answer was in response to your original question about the circle hover. This is the problem when you keep changing questions half way through.
Where is your example with the tooltips working?
asasass
December 24, 2017, 11:35am
17
Tooltips work.
Hover is broken:
asasass
December 24, 2017, 11:47am
18
Why would I use 0 when there’s no issue with 1?
.playd,
.paused {
position: absolute;
top: -4px;
right: 0;
bottom: 0;
left: 4px;
margin: auto;
fill: #0059dd;
z-index: 1;
}
.paused {
left: 0;
}
.stack {
position: relative;
z-index: 2;
stroke-width: 2;
stroke: green;
fill: transparent;
}
.stack:hover {
stroke: red;
}
.linesd::before,
.linesd::after {
content: "";
position: absolute;
z-index: 3;
top: 0;
left: 83px;
width: 3px;
height: 100%;
background: #0059dd;
}
.linesd::after {
left: 174px;
}
asasass
December 24, 2017, 11:54am
20
Do you mean like this?
.playd,
.paused {
z-index: auto;
.stack {
z-index: 1;
.linesd::before,
.linesd::after {
z-index: 2;
PaulOB
December 24, 2017, 11:55am
21
Moving target springs to mind!
Can you show an example where the tooltips are working in Chrome?
1 Like
asasass
December 24, 2017, 11:58am
23
.playd,
.paused
Doesn’t require a z-index.
Correct?
If it works without it, then one is not needed.
asasass
December 24, 2017, 12:04pm
24
Never mind, it is required in order for tooltips to work.