我试图将列表中的第 1 个 div 设置为 box2、2nd 和 3rd,设置为 box,将第 4 个设置为 box3,然后重复框 1 到 4。
好奇是否有更短的方法来使用柜台。
jQuery(document).ready(function($) {
var repos = $('#repositories');
var username = 'username';
var count = 0;
$.getJSON('http://github.com/api/v2/json/repos/show/' + username + '?callback=?',      function(data, status) {
    $.each(data.repositories.reverse(), function() {
        if (this.name != username + '.github.com') {
            count++;
            if (count == 1) {
                var boxes = 'box2';
            } else if (count == 4) {
                var boxes = 'box3';
                count = 0;
            } else {
                var boxes = 'box';
            }
            line = $('<div class="' + boxes + '"> <h3>' + this.name + '</h3> <p>' + this.description + '</p> <p><a href="' + this.url + '">more...</a></p> </div>').hide();
            $(repos).append(line);
            $(line).fadeIn(500);
        }
      });
  });