Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » Twitter bootstrap accordion not working

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3231 Views
  • MarkusM
    Avatar
    Community Member
    11 Posts

    Twitter bootstrap accordion not working Link to this post

    I want to add a Twitter Bootstrap accordion to my SilverStripe-website. I am using SS 3.0.5 on Ubuntu and the Twitter Bootstrap theme from http://www.silverstripe.org/twitter-bootstrap-theme/. What I did was:

    I added the following two lines at the top of my template (.ss) file:

    <% require javascript(themes/aep-bootstrap/js/bootstrap.js) %>
    <% require javascript(themes/aep-bootstrap/js/bootstrap-collapse.js) %>
    Then I added a new "row-fluid" and copied the sample code from http://twitter.github.io/bootstrap/javascript.html#collapse inside it:

    <div class="row-fluid">
    <div class="accordion" id="accordion2">
    <div class="accordion-group">
    <div class="accordion-heading">
    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
    Collapsible Group Item #1
    </a>
    </div>
    <div id="collapseOne" class="accordion-body collapse in">
    <div class="accordion-inner">
    Anim pariatur cliche...
    </div>
    </div>
    </div>
    </div>
    </div>
    The result is that the text displays in my site, but it is not collapsible. I guess the probem is that the javascript can not be found, but the reference to it is correct and AFAIK the standard way to include javascript in SS templates.

  • MarkusM
    Avatar
    Community Member
    11 Posts

    Re: Twitter bootstrap accordion not working Link to this post

    [replying myself]

    I added

    <script src="$ThemeDir/js/bootstrap-collapse.js"></script>

    to the end of my document and then it worked.

  • Mattes
    Avatar
    Community Member
    1 Post

    Re: Twitter bootstrap accordion not working Link to this post

    Danke!

    3231 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.