Bootstrap 3 + backbonejs - 切换导航无法打开 [英] Bootstrap 3 + backbonejs - Toggle nav not opening
本文介绍了Bootstrap 3 + backbonejs - 切换导航无法打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的项目使用jquery,backbonejs,underscorejs和bootstrap 3(
解决方案
如何abt this..cleaner方式
define(['jquery','underscore','backbone','text!templates / home / homeTemplate.html'],function( $,_,Backbone,homeTemplate){
var HomeView = Backbone.View.extend({
el:$(#page),
events :{
'点击[data-toggle = offcanvas]':'toggleClass'
},
渲染:function(){
this。$ el.html (homeTemplate);
},
toggleClass:function(e){
this。$('。row-offcanvas')。toggleClass(活性);
}
});
返回HomeView;
});
I am using jquery, backbonejs, underscorejs and bootstrap 3 for my project (https://izify.com/). This is my source code https://github.com/datomnurdin/izify-template. I can't open toogle nav when click the button.
This is screenshot for toogle nav.
My offcanvas.js
$(document).ready(function() {
$('[data-toggle=offcanvas]').click(function() {
$('.row-offcanvas').toggleClass('active');
});
});
Is there any problem when integrate with backbonejs?
I take the template from here, http://getbootstrap.com/examples/offcanvas/
Demo site: http://staging.revivalx.com/izify-template/
解决方案
how abt this..cleaner way
define(['jquery', 'underscore','backbone','text!templates/home/homeTemplate.html'], function($, _, Backbone, homeTemplate){
var HomeView = Backbone.View.extend({
el: $("#page"),
events: {
'click [data-toggle=offcanvas]' :'toggleClass'
},
render: function(){
this.$el.html(homeTemplate);
},
toggleClass: function (e) {
this.$('.row-offcanvas').toggleClass('active');
}
});
return HomeView;
});
这篇关于Bootstrap 3 + backbonejs - 切换导航无法打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文