Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Hover event, but not on touch/mobile devices Reply To: Hover event, but not on touch/mobile devices

#299532
Atelierbram
Participant

Can be done with just CSS, no javaScript needed:

.preview {
  /* display: none; */
  opacity: 0;
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 1;
  height: 50%;
  transition: all .3s;
}

[id="test-parent"]:hover ~ .preview { 
  opacity: 1; 
}