Kendo ui has navigation menu
2 answers
I came up with this solution. Note that in this example, Kendo classes are not imported, so it does not show the correct result. Please import the kendo css classes to get correct results as shown in the screenshot below.
$("#tree").kendoTreeView({
select: function(e) {
var breadcrumb = [];
var treeView = this;
$(e.node)
.parents("li")
.andSelf()
.each(function() {
var nodeText = $.trim(treeView.text(this));
breadcrumb.push(nodeText);
});
breadcrumb = breadcrumb.join(" > ");
$("#breadcrumb").text(breadcrumb);
}
});
.k-bot{
float:left;
}
.k-item{
margin:20px;
}
.k-icon{
margin-left:0 !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
Breadcrumb Trail: <span id="breadcrumb">Root</span>
<ul id="tree">
<li>Root
<ul>
<li>Parent 1
<ul>
<li>Child 1</li>
</ul>
</li>
</ul>
</li>
</ul>
+4
source to share
The following is an example Breadcrumb for KendoMenu:
$("#menu").kendoMenu({
select: function(e) {
var breadcrumb = [];
var treeView = this;
$(e.item)
.parents("li")
.andSelf()
.each(function() {
var nodeText = $.trim($(this).find('span:first').text());
breadcrumb.push(nodeText);
});
breadcrumb = breadcrumb.join(" > ");
$("#breadcrumb").text(breadcrumb);
}
});
+1
source to share