$.fn.lrtimeline = function (nodelist) { // title 标题 // people 审核人 // content 内容 // time 时间 var $self = $(this); if ($self.length == 0) { return $self; } $self.addClass('z-timeline'); var $wrap = $('
'); var $ul = $(''); // 开始节点 var $begin = $('
  • 当前
  • ') $ul.append($begin); $.each(nodelist, function (_index, _item) { // 中间节点 var $li = $('
  • '); if (_index == 0) { $li.find('div').addClass('z-timeline-current'); } var $itemwrap = $li.find('.z-timeline-wrap'); var $itemcontent = $('
    '); $itemcontent.append('
    ' + _item.title + '
    '); $itemcontent.append('
    ' + _item.people + '' + _item.content + '
    ') $itemwrap.append('' + _item.time + ''); $itemwrap.append($itemcontent); $ul.append($li); }); // 结束节点 $ul.append('
  • 开始
  • '); $wrap.html($ul); $self.html($wrap); };