Twitter bootstrap collapse: change display of toggle button

后端 未结 10 742
有刺的猬
有刺的猬 2020-12-12 23:50

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:

<         


        
10条回答
  •  没有蜡笔的小新
    2020-12-13 00:05

    I liked the CSS-only solution from PSL, but in my case I needed to include some HTML in the button, and the content CSS property is showing the raw HTML with tags in this case.

    In case that could help someone else, I've forked his fiddle to cover my use case: http://jsfiddle.net/brunoalla/99j11h40/2/

    HTML:

    MyHeading

    Here comes the text...

    CSS:

    button.btn .show-ctrl{
        display: none;
    }
    button.btn .hide-ctrl{
        display: block;
    }
    button.btn.collapsed .show-ctrl{
        display: block;
    }
    button.btn.collapsed .hide-ctrl{
        display: none;
    }
    

提交回复
热议问题