0

I've created a sidebar menu that expand out when a button is pressed

I've tried to attached glyphicons but it shows the expanded view by default. How can I get the expected behaviour as per the example?

http://jsfiddle.net/4dgaurav/YJB4q/11/

Here is an example part of my code

<li> <a class='expandable' href='#' title='MyChallenges'>
            <%= link_to discovers_path, class: "btn" do %>
            <span class="glyphicon glyphicon-fire"></span>
            <% end %>
            <span class='expanded-element'>Discover</span>
          </a>
Sebastian Zeki
  • 6,690
  • 11
  • 60
  • 125

1 Answers1

0

After a lot of trial and error this is what worked for me

<li> 
          <%= link_to ' <span class="glyphicon glyphicon-eye-open collapsed-element"></span><span class="expanded-element">Discover</span>'.html_safe, discovers_path, class: 'expandable' %>
          </li>

My mistake was to not realise that the link_to actually generates the <a></a> tags

Sebastian Zeki
  • 6,690
  • 11
  • 60
  • 125