Domanda

Take a look this link.

I am trying to implement this. My problem is what are the "options" variable in script? Imagine this html code for my breadcrumb:

<div>
   <ul class="breadcrumb" id="breadcrumb">
       <li>
          <a href="#">Home</a> <span class="divider">/</span>
       </li>
    </ul>
 </div>

After this, I have something like this for my lateral menu:

<ul>
   <li><a class="b-link" href="@Url.Content("~/Produts")">Produts</a></li>
   <li><a class="b-link" href="@Url.Content("~/Clients")">Clients</a></li>
</ul>

Then, when I click in Produts, I want that breadcrumb changes dynamically using bootstrap-breadcrumb.js.

I think that the javascript should look like the code below, but, what are the options?

$(document).ready(function () {

   var breadcrumb = $('#breadcrumb').breadcrumb(options);
      $('a.b-link').click(function () {
         breadcrumb.push($(this).text());
         //breadcrumb.pop();
      });
});

Any ideas? Thank you very much.

P.S. My project is in MVC 4.

È stato utile?

Soluzione

I think you can pass divider to it, since the options are just passed down to settings and the only thing used in settings is divider. So you can have '|', '*' or anything else passed down and used as dividers. Instead of the default '/'

$.fn.breadcrumb.defaults = {
    divider: '/', 
    keyboard: false
}

Seems to match with the documentation as well: http://jeluard.github.io/bootstrap-breadcrumb/index.html

Options

Name type default description divider string / String used as divider.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top