Solved

Bootstrap 3 slider Box on slider

Posted on 2014-01-16
3
1,574 Views
Last Modified: 2014-01-16
Hello, I have a div layer (the orage) on the slider instead of the picture, so I can have plain text.


Example
<!--slider -->         
    <div id="myCarousel" class="carousel slide">
    	<!-- 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>   
        <!-- Carousel items -->
        <div class="carousel-inner">
            <div class="active item"><img src="images/banner1.png" alt="Banner1"></div>
            <div class="item"><img src="images/banner1.png" alt="Banner2"></div>
            <div class="item"><img src="images/banner1.png" alt="Banner3"></div>
        </div>
        <!-- Carousel nav -->
        <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
        <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
    </div>
<!--slider end-->

Open in new window

0
Comment
Question by:MickeC
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
Comment Utility
I'm not sure what your question is.  

Are you asking how?

Replace
<div class="carousel-inner">
            <div class="active item"><img src="images/banner1.png" alt="Banner1"></div>
            <div class="item"><img src="images/banner1.png" alt="Banner2"></div>
            <div class="item"><img src="images/banner1.png" alt="Banner3"></div>
        </div>

Open in new window


with
<div class="carousel-inner">
            <div class="active item"><img src="images/banner1.png" alt="Banner1"></div>
            <div class="item"><img src="images/banner1.png" alt="Banner2"></div>
            <div class="item">My Text</div>
        </div>

Open in new window

0
 

Author Comment

by:MickeC
Comment Utility
Sorry but I want the image in the background.
the orange part of the image I want to make into a div which I a set css to orange and have text on it. Div should be poitioneras right
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
OK. Using the bootsrap example http://getbootstrap.com/examples/carousel/ I simply wrapped the copy of the first slide around a div and give it a class called orange. It needs some tweeking but this will get you going.

http://jsbin.com/axEGasI/1/edit

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style>
    .container{width:500px;}
    .orange{
      
      width:300px;
      height:225px;
      background-color:orange;
      opacity:0.7;
      margin-left:100px;
      
    }
  </style>
</head>
<body>
 <div class="container">
    <!-- Carousel
    ================================================== -->
    <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">
        <div class="item active">
          <img src="http://www.luxurydaily.com/wp-content/uploads/2012/11/audi-ski-challenge.jpg" alt="First slide">
          <div class="container">
            <div class="carousel-caption">
              <div class="orange">
              <h1>Example headline.</h1>
              <p>Note: If you're viewing this page via a <code>file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</p>
             
              </div>
            </div>
          </div>
        </div>
        <div class="item">
          <img src="http://usskiteam.com/sites/default/files/styles/media_main_picture_580x325/public/drupal/news_article/mainimage/2012/218139_10151008665252693_68723542_n.jpg" alt="Second slide">
          <div class="container">
            <div class="carousel-caption">
              <h1>Another example headline.</h1>
              <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
              <p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
            </div>
          </div>
        </div>
        <div class="item">
          <img src="http://alpine.usskiteam.com/sites/default/files/styles/media_main_picture_580x325/public/drupal/news_article/mainimage/2014/mancusoZauch.jpg" alt="Third slide">
          <div class="container">
            <div class="carousel-caption">
              <h1>One more for good measure.</h1>
              <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
              <p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
            </div>
          </div>
        </div>
      </div>
      <a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
      <a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
    </div><!-- /.carousel -->
  </div>
</body>
</html>

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn how to dynamically set the form action using jQuery.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now