bootstrap collapse: change display of toggle button icons and text

后端 未结 5 1050
[愿得一人]
[愿得一人] 2021-01-01 23:15

I am using Twitter Bootstrap to create collapsible sections of text. The sections are expanded when a + button is pressed. My html code as follows:

Demo link

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-01 23:26

    It is also possible to do by css styles.

    in css add style:

    .text-toogle[aria-expanded=false] .text-expanded {
      display: none;
    }
    .text-toogle[aria-expanded=true] .text-collapsed {
      display: none;
    }
    

    and use in html:

    
    

    Please remember to add attribute

    aria-expanded="false"
    

    and class

    text-toogle
    

    to link / button.

提交回复
热议问题