Collapsing the sidebar after clicking a link inside the sidebar

73 views
Skip to first unread message

nideesh manian

unread,
Jun 30, 2015, 9:29:03 AM6/30/15
to ang...@googlegroups.com
I have an always visible sidepanel in my site (angular + bootstrap)
I wanted the sidepanel to hide itself when viewing on mobile version and sidepanel should come up when clicking a button, 
I added the collapse class to the panel, and a button on top with data-target to point the sidepanel.
The sidepanel displays permanently in browser view and hides in mobile view. I can toggle the sidepanel in mobile views
My sidepanel contains link. I wanted the sidepanel to disappear when any link inside sidepanel is clicked. How can we do that?

My current code is something like below
<div class="col-lg-10 col-sm-10 col-md-10 col-xs-12">
            <div class="row">
                <div class="col-lg-12 col-sm-12 col-md-12 col-xs-9 " >
                    <div class="heading" >
                        Payments<button style="float:right; margin-top:0; padding-top:0" type="button" class="navbar-toggle" data-toggle="collapse" data-target="#page-sidebar">
    <span class="glyphicon glyphicon-th-list"></span>
</button>
                    </div>
                    
                </div>
            </div>
</div>

        <div id="page-sidebar" class="collapse navbar-collapse .col-lg-2 col-sm-2 col-md-2 col-xs-3 page-sidebar">
            <ul class="sidebar">
                <li><a>asd</a></li>
                <li><a>asd</a></li>
                <li><a>asd</a></li>
                <li><a>asd</a></li>
                <li><a>asd</a></li>
            </ul>
        </div>

Mark Volkmann

unread,
Jun 30, 2015, 11:21:47 AM6/30/15
to ang...@googlegroups.com
Check out this demo I created recently. https://github.com/mvolkmann/toggle-nav

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
R. Mark Volkmann
Object Computing, Inc.
Reply all
Reply to author
Forward
0 new messages