2016-11-17 66 views
1

說我有2個父divs(包括圖片),只有當瀏覽器從md的屏幕大小轉換爲xs時,是否可以將孩子從div2移動到div1?移動一個孩子出父母div並進入一個新的div在Bootstrap?

<div class="col-xs-12 col-md-6"> 
    <h1> 1 </h1> 
    <h1> 2 </h1> 
    <!-- 5 goes here --> 
    </div> 
    <div class="col-xs-12 col-md-6"> 
    <h1> 3 </h1> 
    <h1> 4 </h1> 
    <h1> 5 </h1> <!--- move this --> 
    </div> 

因此,將h1的文本移動到h1下的文本爲5,文本爲2? 我在想沒有,因爲孩子們在div元素容器?因此,拉動它不會幫助

enter image description here enter image description here

回答

0

一個CSS唯一的解決辦法

如果DIV#5的含量並不大,靜態我將複製這兩個包含div的內容和然後使用響應式實用程序隱藏內容以隱藏並顯示不同斷點處的div http://getbootstrap.com/css/#responsive-utilities

Javascript解決方案

考慮http://api.jquery.com/replaceWith/

$("div.third").replaceWith($(".first")); 
+0

是的感謝,這就是我想用「看得見的-XS」和「隱藏XS」做的不知道,如果有另一種方式 – abcf