There are a couple I know of that are pretty great:
You could use jquery instead if you can't don't like any of them:
<script>
jQuery(document).ready(function($) {
var breadcrumb_1 = $('li.item>a:eq(0)').text();
var breadcrumb_1_link = $('li.item>a:eq(0)').attr('href');;
var breadcrumb_2 = $('li.item>a:eq(1)').text();
var breadcrumb_2_link = $('li.item>a:eq(1)').attr('href');;
html = '<div class="breadcrumb">';
html += '>> <a href="' + breadcrumb_1_link + '">' + breadcrumb_1 + '</a>';
console.log( 'b1 ' + breadcrumb_1 + ' b2:' + breadcrumb_2 + ':' );
if(breadcrumb_2 != breadcrumb_1 && breadcrumb_2 != '') {
html += ' <span> > > </span> ';
html += ' <a href="' + breadcrumb_2_link + '">' + breadcrumb_2 + '</a>';
}
html += '</div>';
//make sure you have a div with id breadcrumb in existence before this.
$('#breadcrumb').html(html);
});
</script>
Great suggestions. I woul rather use something for backend for breadcrumbs in my application that will e able to be passed from page to page dynamically with child/parent pages as well as category.
Takes a bit of setup time to configure the breadcrumbs file if your app is large, but it does a nice job:
stickman373 said:
Takes a bit of setup time to configure the breadcrumbs file if your app is large, but it does a nice job:
I've looked at this but I'm struggling with the set up. I have my breadcrumbs.php inside the app directory and have the following route:
Breadcrumbs::register('users', function($breadcrumbs) {
$breadcrumbs->push('Users', route('users/index'));
});
This works however with how I have my templating set up I need to figure out how I can just have it see what page its currently on and display the breadcrumbs from the breadcrumbs file.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community