Javascript 组API结果为一个DIV

Javascript 组API结果为一个DIV,javascript,google-api,Javascript,Google Api,我真的很难编辑JS代码/API(GoogleFeeds),使其在响应性设计中工作 目前,API的结果如下所示: <div class="gfg-subtitle"></div> <div class="gfg-list"></div> <div class="gfg-subtitle"></div> <div class="gfg-list"></div> ... 请参阅:有很多逻辑,我不熟悉上的A

我真的很难编辑JS代码/API(GoogleFeeds),使其在响应性设计中工作

目前,API的结果如下所示:

<div class="gfg-subtitle"></div>
<div class="gfg-list"></div>
<div class="gfg-subtitle"></div>
<div class="gfg-list"></div>
...

请参阅:

有很多逻辑,我不熟悉上的API,但您可以按如下方式对条目进行分组:

    // group the Title and List
    var groupDiv = document.createElement('div');
    groupDiv.className = 'gfg-grouped';
    groupDiv.appendChild(newTitle);
    groupDiv.appendChild(newList);

您将得到如下结果:

$intendedContainer = $("");
$(".gfg-subtitle").each(function(){
  var $list = $(this).next().detach();
  var $subitle = $(this).detach();

  var $groupItem = $("<div class='gfg-group'></div>");
  $groupItem.append($list).append($subtitle);
  $groupItem.insertBefore($subTitle);

  $intendedContainer.append($groupItem);
});
$intendecontainer=$(“”);
$(“.gfg副标题”)。每个(函数(){
var$list=$(this.next().detach();
var$subtitle=$(this.detach();
var$groupItem=$(“”);
$groupItem.append($list).append($subtitle);
$groupItem.insertBefore($subTitle);
$intendecontainer.append($groupItem);
});

我没有通读您的整个代码,因为它非常庞大,但这是您需要实现的逻辑。

感谢前面的回复,我继续自己解决了它(花了我很长的时间,但这就是我们学习的方式,好吗?:)如果可以帮助某人,请将解决方案留在这里

我添加了以下行:

 var newGroup = this.createDiv_('gfg-grouped');


看:

谢谢你,大卫,我试试这个。
    // group the Title and List
    var groupDiv = document.createElement('div');
    groupDiv.className = 'gfg-grouped';
    groupDiv.appendChild(newTitle);
    groupDiv.appendChild(newList);
$intendedContainer = $("");
$(".gfg-subtitle").each(function(){
  var $list = $(this).next().detach();
  var $subitle = $(this).detach();

  var $groupItem = $("<div class='gfg-group'></div>");
  $groupItem.append($list).append($subtitle);
  $groupItem.insertBefore($subTitle);

  $intendedContainer.append($groupItem);
});
 var newGroup = this.createDiv_('gfg-grouped');
   if (!this.options.horizontal && this.options.stacked) {
        var newGroup = this.createDiv_('gfg-grouped');
        var newTitle = this.createDiv_('gfg-subtitle');
        nodes.root.appendChild(newGroup);
        newGroup.appendChild(newTitle);
        this.setTitle_(this.results[0].feed, newTitle);
  newGroup.appendChild(nodes.list);