Bootply: http://www.bootply.com/66501
I want to put hero-unit box in the middle of the page (vertically). I set the size(span10) for the box. Also, there is a problem that the text from the bar is a little bit off and I don't know the reason. Please help me out!
<div id="myCarousel" class="carousel slide fullscrn">
<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="item active fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
<div class="item fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
<div class="item fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
</div> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
<div class="hero-unit span10">
<h1>Test</h1>
<p>
</p><div class="progress progress-striped active">
<div class="bar" style="width: 11%;">11%</div>
</div>
<p></p>
<p>
<a class="btn btn-primary btn-large">
Learn more
</a>
</p>
</div>
for CSS:
.fullscrn{
height: 100%;
width:100%;
}
here is your solution
<div id="full-screen-slider" class="carousel slide">
<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 fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
<div class="item fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
<div class="item fullscrn">
<img src="http://placehold.it/600x480" class="fullscrn">
</div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a> <a class="carousel-control right"
href="#myCarousel" data-slide="next">›</a>
</div>
<style>
#full-screen-slider
{
margin-bottom: 0;
}
.carousel .carousel-inner .item img
{
width: 100%;
}
.all-sliders
{
position: fixed;
top: 25px;
right: 25px;
color: white;
z-index: 10;
}
.all-sliders:hover
{
color: white;
}
</style>
<div style="top: 21%; left: 16%; position: absolute;" class="container">
<div class="content">
<div class="hero-unit span10 ">
<h1>
Test</h1>
<p>
</p>
<div class="progress progress-striped active">
<div class="bar" style="width: 11%;">
11%</div>
</div>
<p>
</p>
<p>
<a class="btn btn-primary btn-large">Learn more </a>
</p>
</div>
</div>
</div>
<script src="Scripts/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
function setFullScreen() {
browserHeight = $(window).height();
$("#full-screen-slider .carousel-inner .item img").css({
height: browserHeight - 20
});
}
$("#full-screen-slider .carousel-inner .item:eq(0)").addClass('active');
setFullScreen();
$(window).resize(function () {
setFullScreen();
});
$("#full-screen-slider").carousel({ interval: 5000 });
if ($('.content').length > 0) {
$('.content').css('height', ($(window).height() - $('.content-section').offset().top - 120));
}
});
</script>
Related
I have a generic bootstrap v3.7 carousel and I'm trying to pull it up over the content above it like this
This is done with a margin-top: -50px; on the teal div. However, the hidden overflow property of the carousel is causing the top to be cut off above the top of the div, so I cannot achieve this overlay design. My attempts to modify the CSS have only broken the carousel. Is it possible to do this?
The margin-top should be applied the div containing .carousel, perhaps you are using it on the div with the calls carousel;
Following code snippet is what you're trying to achieve:
.aboveCarousel {
height: 300px;
background: magenta;
}
.container {
margin-top: -50px
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<div class='aboveCarousel'> </div>
<div class="container">
<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>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://www.w3schools.com/bootstrap/la.jpg" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/chicago.jpg" alt="Chicago" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/ny.jpg" alt="New york" style="width:100%;">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
.mainIDv
{
height:300px;
width:400px;
padding:5px;
margin: 8px auto 8px auto;
}
.ImgDisp{
background-color:cyan;
height:100%;
width:100%;
}
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 100% !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="mainIDv">
<div class="ImgDisp">
<div id="carouselSection" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#carouselSection" data-slide-to="0"></li>
<li data-target="#carouselSection" data-slide-to="1"></li>
<li data-target="#carouselSection" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" alt="Los Angeles" >
<div class="carousel-caption">
<h3>Tomorrow land </h3>
<p>We had good friends here!</p>
</div>
</div>
<div class="carousel-item">
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" alt="Chicago" style="width: 100%; height: 100%;">
<div class="carousel-caption">
<h3>HappyLand</h3>
<p>Thank you!</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
I tried to create a slide show using carousel of bootstrap 4. I used the carousel code section within a div block. But my problem is height of images used within the carousel is not matching with the height of the div holding it. I tired every solutions suggested here, but none works for me.
here is my code.
<div class="ImgDisp">
<div id="demo" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="Images/Img12.png" alt="Los Angeles" >
<div class="carousel-caption">
<h3>Tomorrow land </h3>
<p>We had good friends here!</p>
</div>
</div>
<div class="carousel-item">
<img src="Images/Img4.jpg" alt="Chicago" style="width: 100%; height: 100%;">
<div class="carousel-caption">
<h3>HappyLand</h3>
<p>Thank you!</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
I want images with height and width 100% matching with the div ImgDisp.
I tired overriding the styles defined for components like carousel, carousel-inner, carousel-item. but only width is working for me. Even tried to change the image styles.
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 100% !important;
}
I don't know why, somebody suggest a solutions. Thanks in advance.
you are overriding your img height by 10% in this style
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 10% !important;
}
change it to 100%.
The question was asked before on Stackoverflow here: Bootstrap carousel ignoring data-interval attribute
But the answer was not relevant in my case.
As stated in the title the data-interval attribute does not change the time each slide lingers in the carousel. at the moment it is too fast. I have searched for where this is coming from in the CSS, but I cannot see anything related to the interval time. Here is my HTML:
<!-- Header Carousel -->
<header id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="3000">
<!-- 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>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<div class="fill"><%= image_tag "Acu.png"%></div>
<div class="carousel-caption">
<h2>Caption 1</h2>
</div>
</div>
<div class="item">
<div class="fill" ><%= image_tag "terapia-nut.png"%></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<div class="fill" ></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</header>
<!-- Page Content -->
<div class="container">
.
.
.
.
.
.
<!-- /.container -->
<!-- Script to Activate the Carousel -->
<script>
$(document).on('ready', function () {
$('.carousel').carousel({
interval: 1000 //changes the speed
})
});
</script>
CSS for carousel
/* Home Page Carousel */
header.carousel {
height: 50%;
}
header.carousel .item,
header.carousel .item.active,
header.carousel .carousel-inner {
height: 100%;
}
header.carousel .fill {
width: 100%;
height: 100%;
background-position: center;
background-size: cover;
}
What other possible causes of this could there be?
Where can I see the raw bootstrap 3 CSS files in order to know what classes are controlling what attributes? Because they are hidden I often find it hard to know which classes and which attributes to change in order to control the CSS.
LINK TO WEBSITE TEST PAGE:
WEBPAGE LINK
I'm trying to have a carousel with no background. So the images and indicators are just displayed as is.
Have tried this:
.carousel{
background:none;
background-color: none;
}
Which didn't make a difference, I also tried adding a placeholder as a background to see what it did:
.carousel{
background: url(http://placehold.it/620x420/);
}
This added the placeholder background but behind the shading of the carousel. I've uploaded an image here:
Hopefully someone knows what I've done wrong, thanks in advance.
EDIT: Added HTML code for carousel:
<!-- Image Gallery Start-->
<br/><br/>
<div id="Carousel" class="carousel slide" data-ride="carousel" style="max-width: 400px; margin: 0 auto">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#suniceCarousel" data-slide-to="0" class="active"></li>
<li data-target="#suniceCarousel" data-slide-to="1"></li>
<li data-target="#suniceCarousel" data-slide-to="2"></li>
<li data-target="#suniceCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive center-block" src="/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#Carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#Carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</br></br>
<!-- Image gallery end-->
If I've understood you just want to remove the gradient the chevrons have for a background?
#Carousel .carousel-control.left,
#Carousel .carousel-control.right {
background-image: none;
}
This should be all you need. Here is an example below
#Carousel .carousel-control.left,
#Carousel .carousel-control.right {
background-image: none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- Image Gallery Start-->
<br/>
<br/>
<div id="Carousel" class="carousel slide" data-ride="carousel" style="max-width: 400px; margin: 0 auto">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#suniceCarousel" data-slide-to="0" class="active"></li>
<li data-target="#suniceCarousel" data-slide-to="1"></li>
<li data-target="#suniceCarousel" data-slide-to="2"></li>
<li data-target="#suniceCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#Carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#Carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</br>
</br>
<!-- Image gallery end-->
Try This
.carousel-inner .active{
background:none !important;
}
I've checked the online example, the carousel adds the class active to the current active item.
In your style.css the active class has the following style:
.active{
background: url("images/active-bg.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important;
color: #fff !important;
}
you just need to remove the background property and you'll have a transparent background for every carousel item.
Only this worked:
<a class="left carousel-control" href="#myCarousel" data-slide="prev" style="background-image:none">
<a class="right carousel-control" href="#myCarousel" data-slide="next" style="background-image:none">
Nothing else worked for me.
Hi i am trying to make a bootstrap3 carousel slider and I want to add some images as the slide indicators instead of the list default circles.
Html Markup :
<div id="carousel-slider" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Slider Indicators -->
<ul class="carousel-indicators">
<li data-target="#carousel-slider" data-slide-to="0" class="active"></li>
<li data-target="#carousel-slider" data-slide-to="1"></li>
<li data-target="#carousel-slider" data-slide-to="2"></li>
</ul><!--/ Indicators end-->
</div>
if i add an img tag as below :
<div id="carousel-slider" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Slider Indicators -->
<ul class="carousel-indicators">
<li data-target="#carousel-slider" data-slide-to="0" class="active">
<div class="thumbnail">
<img class="img-responsive" src="https://s3.amazonaws.com/ooomf-com-files/wdXqHcTwSTmLuKOGz92L_Landscape.jpg">
</div></li>
<li data-target="#carousel-slider" data-slide-to="1"></li>
<li data-target="#carousel-slider" data-slide-to="2"></li>
</ul><!--/ Indicators end-->
<div>
Its not showing anything. How can I achieve adding an image as the indicator rather than the circle?
I think the most important thing is to override the width and height properties on the li tags inside the .carousel-indicators.
To do so I've created an additional modifier css class called .carousel-indicators--thumbnails that is added to the .carousel-indicators div. This modifier class is used to override the li, .active and .active .thumbnail class.
.carousel-indicators.carousel-indicators--thumbnails li {
width: 80px;
height: 40px;
margin: 0;
border: none;
border-radius: 0;
}
.carousel-indicators.carousel-indicators--thumbnails .active {
background-color: transparent;
}
.carousel-indicators.carousel-indicators--thumbnails .active .thumbnail {
border-color: #337ab7;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Indicators -->
<ol class="carousel-indicators carousel-indicators--thumbnails">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/400" class="img-responsive">
</div>
</li>
<li data-target="#carousel-example-generic" data-slide-to="1">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/401" class="img-responsive">
</div>
</li>
<li data-target="#carousel-example-generic" data-slide-to="2">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/402" class="img-responsive">
</div>
</li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="http://www.fillmurray.com/800/400" width="800" height="400">
<div class="carousel-caption">
Slide 1
</div>
</div>
<div class="item">
<img src="http://www.fillmurray.com/800/401" width="800" height="400">
<div class="carousel-caption">
Slide 2
</div>
</div>
<div class="item">
<img src="http://www.fillmurray.com/800/402" width="800" height="400">
<div class="carousel-caption">
Slide 3
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>