2

私はかなりの時間を検索し、Jsfiddle を使用してテストしてきましたが、必要なものを選択する方法がわかりません。

ここに私のhtmlコードの一部があります:

<div id="maincontent">
            <div class="section group">
                <div class="col span_1_of_7">
                    <ul class='kwicks kwicks-vertical'>
                        <li id='panel-1'><a id="keyIssues" href="#">Key Issues</a></li>
                        <li id='panel-2'><a id="pollData" href="#">Poll Data</a></li>
                        <li id='panel-3'><a id="bubbles" href="#">Bubbles</a></li>
                        <li id='panel-4'><a id="dataFrom" href="#">Data Collected From</a></li>
                        <li id='panel-5'><a id="group11" href="#">Group 11</a></li>
                    </ul>
                </div>
                <div class="col span_6_of_7">
                    <section id="infographic">
                        <div id ="infographicContent">
                            <img id="banner" src="images/banner.jpg" alt="Federal Election 2013 Logo" >
                            <div id="chart" style="min-width: 310px; height: 700px; margin: 0 auto"></div>
                            <div id="poll" style="min-width: 310px; height: 700px; margin: 0 auto"></div>
                        </div>
                    </section>  
                </div>
            </div>
        </div>

を削除して <div class="col span_6_of_7">から、ファイルから次を追加します。

                    <div class="col span_5_of_7">
                    <section id="infographic">
                        <div id ="infographicContent">
                            <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
                            <script src="js/bubbles.js" ></script>
                            <button>Play</button>
                            <input style="position:inherit;top:4px;" type="range" min="0" max="62" value="0"> 

                        </div>
                    </section>  
                </div>
                <div class="col span_1_of_7">
                    <section id="feed">
                        <div id ="infoFeed">
                          <ul>
                            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
                             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
                             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
                             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
                             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
                             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
                             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
                          </ul>
                        </div>
                    </section>  
                </div>

本当にありがたいので、誰かが私に教えてもらえますか?前もって感謝します。

bubble.html ファイルの内容:

    <div class="col span_5_of_7">
    <section id="infographic">
        <div id ="infographicContent">
            <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
            <script src="js/bubbles.js" ></script>
            <button>Play</button>
            <input style="position:inherit;top:4px;" type="range" min="0" max="62" value="0"> 

        </div>
    </section>  
</div>
<div class="col span_1_of_7">
    <section id="feed">
        <div id ="infoFeed">
          <ul>
            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
            <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
             <li><p><h6>Two-Year-Old Twins Found Locked in Room Alone</h6>Child Services have taken the girls into protective custody after discovering them naked in an empty room with only one blanket</p></li>
             <li><p><h6>SNLs 5 Best Skits: NASA Shuts Down, and Bruce Willis Dances</h6>In this week’s episode of Saturday Night Live, hosted by Bruce Willis: plenty of jokes at Congress’s expense, and just a touch of twerking</p></li>
             <li><p><h6>Man Nearly Killed by Train When Car Got Stuck on Tracks</h6>Blames his GPS device for leading him down the wrong road</p></li>
          </ul>
        </div>
    </section>  
</div>

よろしく、 ネイト

4

3 に答える 3

3

ファイルの内容を読み込んでから、
( selector で両方のクラスを使用して.col.span_6_of_7)コンテナーを削除し
、読み込んだコードをコールバックに追加できます。

$.get('file.html', function(html){
    $('.col.span_6_of_7').remove();
    $('#maincontent').append($(html));  
});
于 2013-10-16T05:39:52.197 に答える
1

これを試して:

$(".col.span_6_of_7").replaceWith("<div>New Div</div>");

そのセレクターは 2 つのクラスを持つ要素を選択し、replaceWithメソッドはまさにそれを行い、新しい要素に置き換えます。

http://jsfiddle.net/DRTdR/

于 2013-10-16T05:39:39.520 に答える
-1

これを試して

$('.col span_6_of_7').replaceWith('.col span_5_of_7')
于 2013-10-16T05:41:03.683 に答える