0

私はこのDIVを持っています:

    <div id="video_container" class="barra">
        <ul>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/Gy3lrgVakII" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/AnwKqlhzCM4" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/wLJM0oi7o9A" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/NRWrYGaqIO8" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/ICUhpeXDrwQ" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/DDVWXbVxIkI" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/ntD69DBs8Q8" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/fuTmK5WHQ18" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/IpUwiyID_Kk" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/snISa71nM_k" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/z6VuNTPuChc" frameborder="0" allowfullscreen></iframe></li>
            <li><iframe width="450" height="253" src="//www.youtube.com/embed/NKzwcbidanM" frameborder="0" allowfullscreen></iframe></li>
        </ul>
    </div>
<div id="video_container_mobile"></div>

同じコンテンツを別の div に入力したい(<ul>...</ul> )

私はこれを持っています:

var list = $("#video_container_mobile").append('<ul></ul>').find('ul');
        $("#video_container ul li").each(function() {
            var el = $(this);
            list.append(el);
        });

これは機能しますが、元の div からの消去、追加していたリストです。

以下の画像を参照してください。

Firebug の画像

Fiddle を参照してください。

http://jsfiddle.net/YgQJM/

2 つの DIV の同じコンテンツを維持したいのですが... 誰か助けてくれますか?

4

2 に答える 2

4
$('#video_container_mobile').append($('#video_container ul ').clone())

http://jsfiddle.net/edY45/

于 2013-10-08T16:44:05.750 に答える
1

おそらく@Husseinほどきれいではありませんが、

$('#video_container_mobile').append($('#video_container').html());
于 2013-10-08T16:46:06.773 に答える