how can i use hover on something with z-index - 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i use hover on something with z-index - 1

i want to use canvas to draw on screen and i want to have it on top, but if i need hover something under it, how can i fix it? in css looks like: p:hover{ [style] } canvas{ z-index: 2; }

17th Nov 2018, 9:32 PM
nicolas turek
nicolas turek - avatar
4 Answers
+ 4
Use javascript. Compare your cursor offsets to the paragraph offsets. In order to z-index to work the element needs a position which your canvas doesn't have.
17th Nov 2018, 10:51 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Can you show us the whole code?
17th Nov 2018, 10:08 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
hm...i've done it by opacity
17th Nov 2018, 10:52 PM
nicolas turek
nicolas turek - avatar
0
there is no much more... there are just two containers, one on second, the first one is over all... and second is scrolling when hover on it the code is on home.spsostrov.cz/~tureni/cursor.htm and it works only on comoputer
17th Nov 2018, 10:11 PM
nicolas turek
nicolas turek - avatar