jquery - dynamic breadcrumb

后端 未结 1 1495
傲寒
傲寒 2020-12-10 09:02

I\'m trying to create a breadcrumb system for my site using the following:


      
      
1条回答
  • 2020-12-10 09:22

    example http://jsfiddle.net/mPsez/3/

    $('.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;
    }) 
    
    0 讨论(0)
提交回复
热议问题