var NavView = View.extend({ el: ".menu", events: { "click li": "click", }, initialize: function(){ }, click: function(e){ var id = $(e.target).data("id") var view = app.lookup[ id ] this.swap( view ) }, previous: function(){ var index = Math.max( app.view.page_number - 1, 0 ) var view = app.projects[ index ] this.swap( view ) }, next: function(){ var index = Math.min( app.view.page_number + 1, app.projects.length - 1 ) var view = app.projects[ index ] this.swap( view ) }, swap: function(view) { if (! view || app.view == view || app.view.showing) { return } console.log(view.page_number, view.project_id) app.view.hide() view.show() app.view = view }, })