css 'pointer-events' property alternative for IE

前端 未结 12 1219
無奈伤痛
無奈伤痛 2020-11-22 02:45

I have a drop down navigation menu in which some of the title should not navigate to other page when clicked(these title open a drop down menu when clicked on) while others

12条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 03:33

    Cover the offending elements with an invisible block, using a pseudo element: :before or :after

    a:before {
    //IE No click hack by covering the element.
      display:block;
      position:absolute;
      height:100%;
      width:100%;
      content:' ';
    }
    

    Thus you're click lands on the parent element. No good, if the parent is clickable, but works well otherwise.

提交回复
热议问题