Button click in my React demo is unresponsive
P粉899950720
P粉899950720 2023-08-14 10:26:58
0
1
654
<p>Why is there no response after clicking the button? </p> <p>My sample code: https://codesandbox.io/s/gallant-knuth-kwf55c</p> <p>I checked my code and found no problem. Please help me solve it. </p>
P粉899950720
P粉899950720

reply all(1)
P粉957723124

The reason is that since all elements are set using position:absolute, the content div overlaps the header.

This results in the header being hidden when interacting. So when we click, the click event is actually fired on the content, not the button (see below).

We can take the following methods:

  • Either remove position:absolute
  • from the DIV
  • Using CSS Viewport Units / calc Functions calculate the height of content to avoid overlapping with the footer
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template