diff --git a/_assets/javascripts/app.js b/_assets/javascripts/app.js index 4f213d8..d7971f8 100644 --- a/_assets/javascripts/app.js +++ b/_assets/javascripts/app.js @@ -1,21 +1,22 @@ function expandNavigation(url) { - return function() { - var segments = url.split("/"); - var page = segments[segments.length - 1]; - var treeview = this; - - var dataSource = this.dataSource; - var node; - - for (var idx = 0; idx < segments.length; idx++) { - node = dataSource.get(segments[idx]); - node.set("expanded", true); - dataSource = node.children; + return function(data) { + if (!data.node) { + var segments = url.split("/"); + var page = segments[segments.length - 1]; + var treeview = this; +​ + var dataSource = this.dataSource; + var node; +​ + for (var idx = 0; idx < segments.length; idx++) { + node = dataSource.get(segments[idx]); + dataSource = node.children; + } +​ + node.set("selected", true); +​ + this.unbind("dataBound", arguments.callee); } - - node.set("selected", true); - - this.unbind("dataBound", arguments.callee); } } diff --git a/_plugins/navigation_generator.rb b/_plugins/navigation_generator.rb index 23dafea..8905bae 100644 --- a/_plugins/navigation_generator.rb +++ b/_plugins/navigation_generator.rb @@ -43,6 +43,11 @@ module Jekyll item['position'] = mapping['position'] if mapping.has_key?('position') end + #Set expanded to all folders on the root level + if index == 0 and item['items'] + item['expanded'] = true + end + node << item end