Jquery Bread Crumb
I'm following this tutorial on creating a bread crumb trail for my webpages. The links, when clicked in the bread crumb trail goes to it's respective page. But the same links, when clicked from the navigation section does not work (stays on the same page) -please see URLs test1.html and test2.html-.
Here is the script:
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<script>
$('.items a').on('click', function () {
var $this = $(this),
$bc = $('<div class="item"></div>');
$this.parents('li').each(function (n, li) {
var $a = $(li).children('a').clone();
$bc.prepend(' / ', $a);
});
$('.breadcrumb').html($bc.prepend('<a href="#home">Home</a>'));
return false;
})
</script>
...here is the HTML / Navigation links:
<div class="breadcrumb">
<div class="item"><a href="index.html">Home / </a></div>
</div>
<div class="items">
<ul>
<li><a href="test1.html">Test 1</a></li>
<li>
<a href="test2.html">Test 2</a>
<ul>
<li><a href="level1">Level 1</a></li>
<li>
<a href="level2">Level 2</a>
<ul>
<li><a href="level3">Level 3</a></li>
<li><a href="level4">Level 4</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#test1">Test 3</a></li>
</ul>
</div>
...the links in the bread crumb goes to it's respective page when clicked; the problem is, the same links, when clicked in the navigation section does not work. Could I get some help as to what I'm doing wrong?
链接地址: http://www.djcxy.com/p/39096.html上一篇: Spring Web Flow可以在非Spring MVC应用程序中工作吗?
下一篇: Jquery面包屑