Breadcrumb using jquery

Posted: February 11, 2016 in JQuery

Insert title here
http://code.jquery.com/jquery-1.12.0.js
<!— http://code.jquery.com/jquery-migrate-1.3.0.js —>

a + a:before {
content: ” >”;
/* content: ” \0020 \f105″; */
color: #D2322D;
}

a:link {
textcoration: none;
}

/*a:visited {
textcoration: underline;
}*/

a: hover {
color: red;
cursor: pointer;
}

.LastElement{
color:red;
cursor:text;

}

$(‘.items a’).on(‘click’, function() {
var $this = $(this),
$bc = $(‘

‘);
$this.parents(‘li’).each(function(n, li) {
$a = $(li).children(‘a’).clone();
$bc.prepend(‘ ‘,$a);
console.log($a);
});

$(‘.breadcrumb’).html( $bc );
$(‘.breadcrumb a’).attr(‘onclick’, ‘testfn(this); return false;’);
$(‘.breadcrumb a’).css(“text-decoration”, “none”);
$( “.breadcrumb a:last-child” ).removeAttr(‘href’);
$( “.breadcrumb a:last-child” ).addClass(“LastElement”);

return false;
});

function testfn(th)
{

var LevelName=$(th).text();
var lenLevel=LevelName.length;

if($(‘.breadcrumb’)){
var EntireHTML = $(‘.breadcrumb’).html();
EntireHTML = EntireHTML.substring(0, EntireHTML.indexOf(LevelName)+lenLevel);
$(‘.breadcrumb’).html(EntireHTML);
$( “.breadcrumb a:last-child” ).removeAttr(‘href’);
$( “.breadcrumb a:last-child” ).addClass(“LastElement”);
//return false;
}
}

Leave a comment