2012-08-13 63 views

回答

1

所以我最终这样做来解决我的问题。我补充说,持有主​​题表上方一个div然后如下帮了我一些jQuery的:

var rows = $('table.bbp-topics').find('tr.super-sticky'); 

     rows.each(function(index) { 
      var headhref = $('a.bbp-topic-permalink', this).attr('href'); 
      var headline = $('a.bbp-topic-permalink', this).html(); 
      var excerpt = $('.excerpt', this).text(); 
      var author = $('a.bbp-author-name', this).html(); 
      var photo = $('a.bbp-author-avatar > img', this).attr('src'); 
      var replies = $('.bbp-topic-voice-count', this).text(); 
      var followers = $('.bbp-topic-reply-count', this).text(); 
      var freshness = $('.bbp-topic-freshness > a', this).html(); 
      var meta = $('p.bbp-topic-meta', this).text(); 


      var newrow = '<div class="featured-row"><div class="topic-meta">' + 
       '<img class="author-photo" src ="' + photo + '">' + 
       '<div class="author">' + author +'</div> ' + 
       '<div class="topic-title"><a href="' + headhref + '">' + headline + '<a/></div>' + 
       '<div class="excerpt">' + excerpt + '</div></div>' + 
       '<div class="replies"><h3>Replies</h3><hr/><p>' + replies + '</p></div> ' + 
       '<div class="followers"><h3>Followers</h3><hr/><p>' + followers + '</p></div> ' + 
       '<div class="freshness"><h3>Updated</h3><hr/><p>' + freshness + '</p></div> ' + 
       ' </div>'; 

      console.log(newrow); 

      $('#supersticky').fadeIn().append(newrow) 

     }) 

希望这可以帮助其他人。