Ordering Div for small screen using bootstrap

Home Forums Web + Tech Answers Ordering Div for small screen using bootstrap

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4442
    Anonymous
    Inactive

    Hello Bryan Sir

    I am trying to ordering child div over parent div for small screen using bootstrap.

    the parent div contains carousel, and child div contains content, I will create form later in this div

    Here is my html code

     <div id="myCarousel" class="carousel slide" data-ride="carousel">
          <!-- Indicators -->
          <ol class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
          </ol>
          <div class="carousel-inner" role="listbox">
            <div class="item active">
              <img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
             </div>
            <div class="item">
              <img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
             </div>
            <div class="item"> 
              <img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
    
            </div>
    
          </div>
    		<div class="col-md-6 SearchBoxHome">The quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dogThe quick brown fox jumps right over the lazy dog</div>
        </div><!-- /.carousel -->
    

    Here is my css

    /* Carousel base class */
    .carousel { 
      height: 405px;
      margin-bottom: 60px;
    }
    /* Since positioning the image, we need to help out the caption */
    .carousel-caption {
      z-index: 10;
    }
    
    /* Declare heights because of positioning of img element */
    .carousel .item {
      height: 405px;
      background-color: #777;
    }
    .carousel-inner > .item > img {
      position: absolute;
      top: 0;
      left: 0;
      min-width: 100%;
      height: 405px;
    }
    * RESPONSIVE CSS
    -------------------------------------------------- */
    
    @media (min-width: 768px) {
     
      /* Bump up size of carousel content */
      .carousel-caption p {
        margin-bottom: 20px;
        font-size: 21px;
        line-height: 1.4;
      }
    
    }
    
    .SearchBoxHome {
        
        height: 300px;
        position: absolute;
        top: 30%;
        margin-top: -100px;
        z-index: 10;
        left: 50%;
        margin-left: -300px;
        text-align: center;
        vertical-align: middle;
    	background:#FFFFFF
    }
    

    Here is Jquery I am trying, but not working.

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

    Please assist me to ordering div for small screen. Child div should display below parent div in small screen.

    Regards

    Parth Ranjan, New Delhi

    #4443
    Bryan Hadaway
    Keymaster

    I’m not entirely sure I understand the issue. Are both divs suppose to appear both on desktop and mobile, or one is hidden on desktop and they both display on mobile, or one displays on desktop and one on mobile and they switch places on mobile? Or perhaps I missed the point altogether of what’s not working.

    Also, please share a live example if you can.

    Thanks

    #4444
    Anonymous
    Inactive

    Current I am working on local host. I have resolved this issue.

    Lots of thanks sir for your continuous support for me type of beginners.

    Thanks

    Parth Ranjan, New Delhi

    #4446
    Bryan Hadaway
    Keymaster

    You’re welcome. :)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.