I would do this with a special observable state that would identify which div to show:
function ViewModel(){ var self = this; self.state = ko.observable(); ... }
Then you just bind it like this:
<div id="books" data-bind="visible: state() === 'books'>...</div> <div id="about" data-bind="visible: state() === 'about'>...</div>
and switch between states as follows:
this.get('#books', function() { self.state("books"); }); this.get('#about', function() { self.state("about"); });
source share