📜  如何使用 Google AMP amp-accordion 创建动画手风琴?

📅  最后修改于: 2022-05-13 01:56:54.386000             🧑  作者: Mango

如何使用 Google AMP amp-accordion 创建动画手风琴?

有时我们有很多内容要显示,为了使网站看起来漂亮而简短,我们会使用可折叠的文本框。可折叠文本框是标题和内容相结合的划分,一般只有标题可见,点击时显示内容。

设置:

您必须在标头中导入 amp-accordion 组件才能使用此标签。

HTML


HTML

    


HTML


  

    
    Google amp amp-accordion
  
    
      
    
      
    
      
    
  
    
  
    
  
    
    

  

    

        Geeks For Geeks     

                    
            

Section 1

                 

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

           
           
            

Section 2

                             

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

              
           
            

Section 3

                             

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

           
    
  


要制作动画手风琴,请使用下面提到的代码。 animate 属性会减慢文本框的折叠和展开速度,使其看起来具有动画效果。

HTML


    

例子:

HTML



  

    
    Google amp amp-accordion
  
    
      
    
      
    
      
    
  
    
  
    
  
    
    

  

    

        Geeks For Geeks     

                    
            

Section 1

                 

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

           
           
            

Section 2

                             

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

              
           
            

Section 3

                             

                GeeksforGeeks is a Computer Science                  portal for geeks. It contains well                  written, well thought and well explained                 computer science and programming                  articles, quizzes etc.             

           
    
  

输出: