I am trying to implement a small toggle sitebar in my ember applictaion. The bootstrap part is easy to implemt. But I've got no clue how to implement the javascript part into a view.
Sidebar I want to use in my app: http://ift.tt/1pu6qXu
Could somebody tell me how to fix the Jquery part? (sidebar is active, but have to be inactive when visiting the website. Sitebar have to pop open at the moment the user clicks on the option button).
import Ember from 'ember';
export default Ember.View.extend({
$(function(){
$('#slide-submenu').on('click',function() {
$(this).closest('.list-group').fadeOut('slide',function(){
$('.mini-submenu').fadeIn();
});
});
$('.mini-submenu').on('click',function(){
$(this).next('.list-group').toggle('slide');
$('.mini-submenu').hide();
})
})
});
<link rel="stylesheet" href="http://ift.tt/14opFsI">
<script src="http://ift.tt/1oMJErh"></script>
<div class="row">
<div class="col-sm-4 col-md-3 sidebar">
<div class="mini-submenu">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</div>
<div class="list-group">
<span href="#" class="list-group-item active">
Submenu
<span class="pull-right" id="slide-submenu">
<i class="fa fa-times"></i>
</span>
</span>
<a href="#" class="list-group-item">
<i class="fa fa-comment-o"></i> Lorem ipsum
</a>
<a href="#" class="list-group-item">
<i class="fa fa-search"></i> Lorem ipsum
</a>
<a href="#" class="list-group-item">
<i class="fa fa-user"></i> Lorem ipsum
</a>
<a href="#" class="list-group-item">
<i class="fa fa-folder-open-o"></i> Lorem ipsum <span class="badge">14</span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-bar-chart-o"></i> Lorem ipsumr <span class="badge">14</span>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-envelope"></i> Lorem ipsum
</a>
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire