Hover over a hidden element to show it

后端 未结 6 1392
臣服心动
臣服心动 2020-12-14 17:19

Is there any way to hover over an element that\'s already hidden. I am trying to mimic what Steam does with their arrow navigation on their home page. You\'ll notice that wh

6条回答
  •  时光说笑
    2020-12-14 17:27

    One way to do this is by using an alternate hit-test div, such that it has no content, but when hovered over it shows the "arrow" div. When the "arrow" div (or the hit-test div) is exited, then the "arrow" div would be hidden once again.

    Alternatively, you could use the same div for the hit-test and the "arrow", such that a background image is used for the visual elements of the div. When hovered, you could instruct the image's offset to be set to a position which would show the "arrow". When exited, you would set the offset of the background to a position where the arrow image would not longer be shown.

    And, finally, if the content will always be in the same position as the hit-test area, you could set the opacity of the div to zero, and toggle accordingly.

提交回复
热议问题