How to create a responsive hamburger menu in AMP HTML

后端 未结 5 1417
栀梦
栀梦 2020-12-31 08:18

I\'m trying to create an AMP HTML website (see https://www.ampproject.org) But i can\'t find anywhere how you are supposed to create a responsive hamburger menu ? Javascript

5条回答
  •  执笔经年
    2020-12-31 08:46

    I have accomplished this with the use of a :target pseudoclass.

    HTML

    
    
    Hamburger Icon

    CSS

    #slide-in-menu {
      transform: translateX(-100%);
      transition: transform .2s ease-in-out;
      ... additional required styles ...
    }
    #slide-in-menu:target {
      transform: translateX(0);
    }
    

提交回复
热议问题