div クラスを生成する jQuery に次のコードがあります。
if (!tst.g.ltContainer) {
      tst.g.ltContainer = $('<div>').addClass('tst-lt-container').addClass('tst-overflow-hidden').css({
        width: inner.width(),
        height: inner.height()
      }).prependTo(inner);
    }
    else {
      tst.g.ltContainer.empty().css({
        width: inner.width(),
        height: inner.height()
      });
    }
これは、次を使用して別の div 内にラップされます。
$(el).find('.tst-layer').wrapAll('<div class="tst-inner"></div>');
このスクリプトを機能させるには、html に何かを追加する必要があったため、非常にうまく機能しました...今度は、XML で機能するようにスクリプトを作成する必要があります..
問題は次のとおりです。
xml の解析中に、必要なすべての div を作成しています...問題は、これが構築されていないことです。
ここに私が書いたものがあります:
$(xml).find('first').each(function() {
        var container = $('<div></div>').appendTo(body);
        container.attr("id", "test-container");
        var first_style = $(this).attr('template.first.style');
        var first = $('<div></div>').appendTo(container);
        spot.attr("id", "placeholder");
        spot.attr("style", first_style);
        $(xml).find('second').each(function() {
            var second_style = $(this).attr('template.second.style');
            var second= $('<div></div>').appendTo(first);
            second.addClass("tst-layer");
            second.attr("style", second_style);
            var bg_src = $(this).attr('background');
            var background = $('<img/>').appendTo(item);
            background.addClass("tst-bg");
            background.attr("src", bg_src);
        })
    });
これがブラウザ経由で返されるものです
     <div id="test-container">
<div id="placeholder" class="tst-container" style="width: 1906px; height: 953px; margin: 0px auto; visibility: visible;">
<div class="tst-inner" style="background-color: transparent; width: 1906px; height: 953px;">
<div class="tst-layer" style="width: 1906px; height: 953px; visibility: visible; display: none;">
実際には次を返す必要があります
<div id="test-container">
<div id="placeholder" class="tst-container" style="width: 1906px; height: 953px; margin: 0px auto; visibility: visible;">
<div class="tst-inner" style="background-color: transparent; width: 1906px; height: 953px;">
<div class="tst-lt-container tst-overflow-hidden" style="width: 1906px; height: 953px;">
<div class="tst-layer" style="width: 0px; height: 960px; visibility: visible; display: none; left: 0px; right: auto; top: 0px; bottom: auto;">
tst-inner のときに tst-lt-container を tst-inner 内に配置するにはどうすればよいですか?