A way to scroll an underlying div when mouse is on top of a fixed div?

前端 未结 4 1141
情歌与酒
情歌与酒 2020-12-03 05:15

The question is so long that coming up with a title that summarises it proved tricky.

So anyway. I have a div that has overflow: auto and t

4条回答
  •  暖寄归人
    2020-12-03 05:58

    What you are looking for is pointer-events: none;

    This makes the pointer not interact with that div essentially, so just do

    #fixed {
      pointer-events: none;
    }
    

    DEMO

    And you will get your desired outcome with no JS required. This will stop all other interaction with the div though, if you need to interact with it for some reason I'm afraid you'll have to look into a JS solution.

提交回复
热议问题