簡體   English   中英

Bootstrap swap div小屏幕

[英]Bootstrap swap div for small screen

我有一個子div,在父div中具有絕對位置。

父div包含具有相對位置的Bootstrap輪播。

這是我的代碼

 <div class="carousel>
    Carousel goes here
    <div class="col-md-6 SearchBoxHome">
       content goes here
    <div>
  </div>

我想在小屏幕上在父div下方顯示子div。

這是我嘗試但無法正常工作的jQuery代碼。

var screenWidth = $(window).width();
if (screenWidth <= 767) {
   $('.carousel').before($('.SearchBoxHome'));
} else {
  return false;
}

請幫我

嘗試這個 :

var screenWidth = $(window).width();
if (screenWidth <= 767) {
    var content = $('.SearchBoxHome');
    $('.carousel').before(content);
    $('.carousel').find('.SearchBoxHome').remove();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM