Bootstrap carousel-control is getting under an image - javascript

I am using the default carousel from bootstrap since i am starting with it, I have three items in my html file. One of them is this:
<div id="myCarousel" class="carousel">
<ol class="carousel-indicators">
<li class="active" data-target="#myCarousel" data-slide-to="0"></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="active item">
<div id="labamba">
<img src="images/cover.jpg" alt="Cover">
</div>
</div>
<div class="item">
<div id="labamba">
<img src="images/cover.jpg" alt="Cover">
</div>
</div>
<div class="item">
<div id="labamba">
<img src="images/cover.jpg" alt="Cover">
</div>
</div>
</div>
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="glyphicon glyphicon-chevron-right"></span>
</div>
I wanted to make my carousel have many items and not only a big image with caption i was trying to ad divs, however i noticed when i put a big image it covered the carousel-control i do not know why. can someone help me out?
CSS overridden:
#myCarousel {
background-color: #222;
background-attachment: fixed;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
padding: 0;
}
#labamba {
font-size: 1.5vw;
position: absolute;
left: 15%;
right: 15%;
bottom: 20px;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #ffffff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
Why the carousel-control has too much height and width? can i just resize it only for the arrow size? i do not know how to do it because when i modify the css it changes the position like if it was a big image and not the arrow only.
I am using Bootstrap 3.3 the github version, i think it is the latest one, i havent modified anything. Thanks for your help.
Screenshot:

Set the z-index: 11; and position: relative on #myCarousel styling.
Post a link to your bootstrap css and I will be able to help you with the 2nd issue.

Related

Change Carousel active indicator as it scrolls or is selected

I have build a boostrap Carousel and modified the indicators to be the map markers with icons in the middle. They rollover fine, but what i was hoping to add is when the corresponding slide below is active they show the hover state.
http://women.hemophilia.on.ca/
What is tied so far is adding the class, as it scrolls, Carousel automatically changes the active class to each item
.marker-recently:hover, .marker-recently .active{
background-image:url(/wp-content/uploads/2021/11/marker-recently-over.png);
}
HTML
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-indicators">
<span data-target="#myCarousel" data-slide-to="0" class="marker-size marker-recently active"></span>
<span data-target="#myCarousel" data-slide-to="1" class="marker-size marker-pregnant"></span>
<span data-target="#myCarousel" data-slide-to="2" class="marker-size marker-period"></span>
<span data-target="#myCarousel" data-slide-to="3" class="marker-size marker-menopause"></span>
<span data-target="#myCarousel" data-slide-to="4" class="marker-size marker-concerns"></span>
<span data-target="#myCarousel" data-slide-to="5" class="marker-size marker-continuing-eduation"></span>
</div>
<br clear="all" />
<div class="carousel-inner">
<div class="carousel-item active">
<div class="container">
<div class="carousel-caption">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-recently-dianosed.png" alt="Recently Diagnosed" width="81" height="95">
<p>I am recently diagnosed with a bleeding disorder and I am looking to learn.</p>
</div>
</div>
</div>
<div class="carousel-item ">
<div class="container">
<div class="carousel-caption text-left">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-pregnant.png" alt="Pregnant" width="71" height="95">
<p>I am pregnant or trying to get pregnant and I have a bleeding disorder.</p>
</div>
</div>
</div>
<div class="carousel-item ">
<div class="container">
<div class="carousel-caption text-left">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-period.png" alt="Started my period" width="77" height="95">
<p>I am about to get my period or I have just started my period recently.</p>
</div>
</div>
</div>
<div class="carousel-item ">
<div class="container">
<div class="carousel-caption text-left">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-menopause.png" alt="Menopause" width="67" height="95">
<p>I have started menopause and want to know bleeding disorder related issues.</p>
</div>
</div>
</div>
<div class="carousel-item ">
<div class="container">
<div class="carousel-caption text-left">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-new-concern.png" alt="Bleeding Concerns" width="116" height="95">
<p>I have a bleeding concerns, could I have a bleeding disorder?</p>
</div>
</div>
</div>
<div class="carousel-item ">
<div class="container">
<div class="carousel-caption text-left">
<img class="first-slide" src="http://women.hemophilia.on.ca/wp-content/uploads/2021/11/icon-continuing-ed.png" alt="Continuing Education" width="73" height="95">
<p>I have had a bleeding disorder for awhile now and I am looking for new info.</p>
</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true">◀</span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true">▶</span>
<span class="sr-only">Next</span>
</a>
</div>
css
/* Carousel base class */
.carousel {
position: inherit;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
z-index: 10;
color: #000;
display: grid;
grid-template-columns: 1fr 3fr;
}
.carousel-caption p {
text-align: left;
font-size: 30px;
font-style: italic;
line-height: 40px;
}
/* Declare heights because of positioning of img element */
.carousel-item {
height: 220px;
background-color: #f8f4ed;
vertical-align: top;
}
.carousel-item > img {
position: absolute;
top: 0;
left: 0;
width: 81px;
height: 95px;
}
.carousel-inner{
margin-top: 90px;
margin-left: -15px;
width: 1120px;
border-bottom: 20px #cf3537 solid;
border-bottom-right-radius: 20px;
border-bottom-left-radius: 20px;
}
.carousel-control-next-icon, .carousel-control-prev-icon {
font-size: 30px;
background-image: none;
color: #cf3537;
margin-top: -100px;
}
.carousel-indicators {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
max-width: 1120px;
margin: 10px 0px 0px 0px;
height: 250px;
top: 0;
background-color: transparent;
background-image: url(images/graphic-road.png);
background-repeat: no-repeat;
background-position: bottom;
}
.carousel-indicators .active {
background-color: transparent;
}
.marker-size {
background-repeat:no-repeat;
background-position: center top;
background-size: 100px 134px;
}
.marker-recently{
background-image:url(/wp-content/uploads/2021/11/marker-recently.png);
}
.marker-recently:hover, .marker-recently .active{
background-image:url(/wp-content/uploads/2021/11/marker-recently-over.png);
}
.marker-pregnant{
background-image:url(/wp-content/uploads/2021/11/marker-pregnant.png);
}
.marker-pregnant:hover, .marker-pregnant .active{
background-image:url(/wp-content/uploads/2021/11/marker-pregnant-over.png);
}
.marker-period{
background-image:url(/wp-content/uploads/2021/11/marker-period.png);
}
.marker-period:hover, .marker-period .active{
background-image:url(/wp-content/uploads/2021/11/marker-period-over.png);
}
.marker-menopause{
background-image:url(/wp-content/uploads/2021/11/marker-menopause.png);
}
.marker-menopause:hover, .marker-menopause .active{
background-image:url(/wp-content/uploads/2021/11/marker-menopause-over.png);
}
.marker-concerns{
background-image:url(/wp-content/uploads/2021/11/marker-concerns.png);
}
.marker-concerns:hover, .marker-concerns .active{
background-image:url(/wp-content/uploads/2021/11/marker-concerns-over.png);
}
.marker-continuing-eduation{
background-image:url(/wp-content/uploads/2021/11/marker-continuing-eduation.png);
}
.marker-continuing-eduation:hover, .marker-continuing-eduation .active{
background-image:url(/wp-content/uploads/2021/11/marker-continuing-eduation-over.png);
}
You already did it right in your CSS sheet, but you just wrote it wrong.
You wrote:
.marker-concerns:hover, .marker-concerns .active
so you are sniping an element with class active as a child of element with class marker-concerns (which it does not exist). Remove the space so when you call:
.marker-concerns.active
You are actually calling an element with BOTH classes (which is what you need).
Remove the blank space from all six css lines ans it should work.

unable to fix width and height of images to 100%

I am working on angular and bootstrap application. I am implementing carousel of bootstrap in my application. Facing the width and height resized issues.
Demo link: https://plnkr.co/edit/tPKXHeN3JWyqZgOtrTTS?p=preview
When user click's on next arrow in the above link, we can see graph but the dimensions of the graph are reduced. I want all the images/graphs used to be 100% width and height.Any suggestions would be helpful.
css code:
.panel-info .panel-heading {
background-color: #c1c6dd;
}
.carousel {
margin-bottom: 0;
padding: 0 40px 30px 40px;
}
.carousel-indicators {
right: 50%;
top: auto;
bottom: -10px;
margin-right: -19px;
}
.carousel-indicators li {
background: #cecece;
}
.carousel-indicators .active {
background: #428bca;
}
.carousel-control.left, .carousel-control.right {
color: #2fa4e7;
background-image: none;
}
.carousel-control {
z-index: 10;
top: 2%;
width: 30px;
font-family: 'Helvetica Neue', Arial, sans-serif;
}
.carousel-control.left { left: -10px; }
.carousel-control.right { right: -10px; }
.carousel-control .glyphicon-chevron-left, .carousel-control .glyphicon-chevron-right {
font-size: 70px;
margin-left : -17px;
margin-right : 24px
}
html code:
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div id='id1' class="item active">
<table style="width:100%;height:80%;">
<tr>
<td id="id1td" ng-controller="myController1">
<div google-chart chart="myChart" style="height:100%; width:100%;" align="center"/>
</td>
</tr>
</table>
</div>
<div id='id2' class="item" ng-controller="myController2">
<table style="width:100%;height:90%;">
<tr style="height:5%;">
<td>
<h1>Title and some content goes here----</h1>
</td>
<tr style="height:85%;">
<td id="id2td">
<div google-chart chart="myChart" style="height:100%; width:100%;" align="center"/>
</td>
</tr>
</table>
</div>
</div>
<!-- Left and right controls -->
<span class="left carousel-control" href="#myCarousel" data-slide="prev" >
<span class="glyphicon glyphicon-chevron-left"></span>
</span>
<span class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</span>
</div>
there is always a problem with tabs and carousel. when you render the chart. if tabs or carousel is not active it will not render charts properly. so I have found the solution for it.
find all delete-me class in the new code it only in index.html file and remove them after page is loaded
<script type="text/javascript" charset="utf-8">
setTimeout(function() {
$('.delete-me').removeClass('active delete-me');
}, 500);
</script>
I just updated your code
DEMO here: https://plnkr.co/edit/EoOxuhH8FTPEOTg5MlHH?p=preview

css bootstrap slider menu fix

So i'm working in this bootstrap carousel, now i have this code working, but i need to fix some issues.
1) make the menu responsive.
2) make the button selected taller than the others.
i tried a lot of thigs but i haven't found the solution yet, so i came here, maybe someone can help me, thank you so much!
This is the image as an example
the code is in the snippet.
$(document).ready(function(ev){
$('#custom_carousel').on('slide.bs.carousel', function (evt) {
$('#custom_carousel .controls li.active').removeClass('active');
$('#custom_carousel .controls li:eq('+$(evt.relatedTarget).index()+')').addClass('active');
})
});
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 100%;
/*margin: auto;*/
/*border: 2px solid green;*/
}
.carrusel {
width: 100%;
height: 40px;
/*margin: auto;*/
border: 3px solid red;
float:right;
margin: 0px 0px 00px 0px;
/*background-color: black;*/
}
.slide{
/*border: 2px solid #093845;*/
width: auto;
}
/*nav slider*/
.navi ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid #e7e7e7;
background-color: #f3f3f3;
border: 1px solid red;
height: 50px;
}
.navi li {
float: left;
border: 1px solid red;
width: 210px;
}
.navi li a {
display: block;
color: #666;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.navi li a:hover:not(.active) {
background-color: #ddd;
}
.navi li a.active {
color: white;
background-color: #4CAF50;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- This file has been downloaded from Bootsnipp.com. Enjoy! -->
<title>Tabbed Slider Carousel (inspired by sevenx.de) - Bootsnipp.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
</style>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<br>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg" alt="Chania" width="460" height="345">
</div>
<div class="item">
<img src="http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg" alt="Chania" width="460" height="345">
</div>
<div class="item">
<img src="http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg" alt="Flower" width="460" height="345">
</div>
<div class="item">
<img src="http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg" alt="Flower" width="460" height="345">
</div>
<div class="item">
<img src="http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg" alt="Flower" width="460" height="345">
</div>
</div>
</div>
<!-- Indicators -->
<div class="navi">
<ul class="">
<li data-target="#myCarousel" data-slide-to="0" class="boton active">Button 1</li>
<li data-target="#myCarousel" data-slide-to="1" class="boton ">Button 1</li>
<li data-target="#myCarousel" data-slide-to="2" class="boton">Button 1</li>
<li data-target="#myCarousel" data-slide-to="3" class="boton">Button 1</li>
<li data-target="#myCarousel" data-slide-to="4" class="boton">Button 1</li>
</ul>
</div>
</div>
</body>
</html>
Ok so I know this is probably a little more than you asked for but I figured I would help out and make this fully responsive for you. I left in the carousel captions and headings just in case you wanted to use them for future use but if not you can just take them out. So what I like to do with the bootstrap carousels is give the carousel item a padding-bottom of a percentage and then mess with this percentage until you get your desired height. Then I like to just give each item a background image of the image that you want to put in your carousel because not all images have the same aspect ratio and you will run into problems with images being skewed otherwise. If you don't want to use the background image method you can just use your method but I figured I would throw this in there because it works best for responsive design. So i give each carousel item a class eg. first-item, second item, third-item and so on and then give then all a backgorund image of whatever your slide image was. Then we will just put your nav underneath the carousel and your all set. Also you will want to add data-interval="false" to your #myCarousel div because when you click on one of the slides it will start to cycle though the slides and your active tabs will still be on the one that you clicked on. Removing active classes while the carousel is in auto interval is a whole different set of jquery markup. Also I have set your carousel nav buttons to 20% because there are 5 of them. If you want them to be a different percentages then add a media query to make them a bigger size like and you will also have to change the carousel-nav height and maybe not have the active button apear bigger as well:
#media screen and (max-width: 767px){
.carousel-nav li{width: 100%;)
}
Here is a working Fiddle demo Fiddle
So here is the markup:
Html:
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
<div class="carousel-inner" role="listbox">
<div class="item active first-item">
<div class="container">
<div class="carousel-caption">
<p class="carousel-heading">Example Heading 1</p>
<p class="carousel-description">Example of a Carousel Description</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Carousel Button</a></p>
</div>
</div>
</div>
<div class="item second-item">
<div class="container">
<div class="carousel-caption">
<p class="carousel-heading">Example Heading 2</p>
<p class="carousel-description">Example of a Carousel Description</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Carousel Button</a></p>
</div>
</div>
</div>
<div class="item third-item">
<div class="container">
<div class="carousel-caption">
<p class="carousel-heading">Example Heading 3</p>
<p class="carousel-description">Example of a Carousel Description</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Carousel Button</a></p>
</div>
</div>
</div>
<div class="item fourth-item">
<div class="container">
<div class="carousel-caption">
<p class="carousel-heading">Example Heading 4</p>
<p class="carousel-description">Example of a Carousel Description</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Carousel Button</a></p>
</div>
</div>
</div>
<div class="item fifth-item">
<div class="container">
<div class="carousel-caption">
<p class="carousel-heading">Example Heading 5</p>
<p class="carousel-description">Example of a Carousel Description</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Carousel Button</a></p>
</div>
</div>
</div>
</div>
</div><!-- /.carousel -->
<ul class="carousel-nav">
<li class="active" data-target="#myCarousel" data-slide-to="0"><button>Button 1</button></li>
<li data-target="#myCarousel" data-slide-to="1"><button>Button 2</button></li>
<li data-target="#myCarousel" data-slide-to="2"><button>Button 3</button></li>
<li data-target="#myCarousel" data-slide-to="3"><button>Button 4</button></li>
<li data-target="#myCarousel" data-slide-to="4"><button>Button 5</button></li>
</ul>
The Css:
#myCarousel .item{
padding-bottom: 50%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
min-height: 250px;
}
#myCarousel .first-item{
background-image: url('http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg');
}
#myCarousel .second-item{
background-image: url('http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg');
}
#myCarousel .third-item{
background-image: url('http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg');
}
#myCarousel .fourth-item{
background-image: url('http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg');
}
#myCarousel .fifth-item{
background-image: url('http://4.bp.blogspot.com/-5GEmJ3I7yUU/UdOLNokyFYI/AAAAAAAAABw/RJJLVs9O02I/s1600/carros+de+lujo+%282%29.jpg');
}
#myCarousel .carousel-heading{font-size: 40px;}
.carousel-nav{
list-style-type: none;
padding: 0;
margin: 0;
height: 50px;
}
.carousel-nav li{
height: 100%;
width: 20%;
float: left;
}
.carousel-nav li button,.carousel-nav li button:focus{
height: 100%;
border: 1px solid red;
width: 100%;
position: relative;
z-index: 2;
outline: 0;
}
.carousel-nav li.active button, .carousel-nav.active li button:focus{
height: 60px;
margin-top: -10px;
outline: 0;
}
/*Responsive Styles*/
#media screen and (max-width: 767px){
#myCarousel .carousel-heading{font-size: 18px;}
#myCarousel .carousel-description{font-size: 12px;}
#myCarousel .btn-primary{font-size: 14px;}
}
And your jquery:
Note: this may require you to use a newer version of jquery so you may want to add this instead of 1.11 in you head
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
then the jquery code:
$(document).on('click', '.carousel-nav button', function() {
$('.carousel-nav li').removeClass('active');
$(this).parent().addClass('active');
});
Change height to auto in the class ".navi ul" so it will be like
.navi ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid #e7e7e7;
background-color: #f3f3f3;
border: 1px solid red;
height: auto;
}
Change width of buttons to 20% in ".navi li" class so it will be like
.navi li {
float: left;
border: 1px solid red;
width: 20%;
}
and add one more class for selected button
.navi li.active a {
background-color: white;
border: 1px solid green;
height: 11%;
margin: -15px 0 0 -2px;
position: absolute;
width: 19%;
}
First important thing to note is that, the JavaScript you mentioned doesn't work as per your markup. Specifically, your active classes are not dynamically changing when the slides move. I have modified the JS code to make it work.
$(document).ready(function(ev){
$('#myCarousel').on('slide.bs.carousel', function (evt) {
$('.navi li.active').removeClass('active');
$('.navi li:eq('+$(evt.relatedTarget).index()+')').addClass('active');
})
});
Also there is a small mistake on your CSS. The active class is applied on the <li> tag and not the <a>, so the active code should be changed to
.navi li.active {
background: blue;
color: white;
}
and NOT .navi li a.active.
And to scale the buttons when active, you can make use of the transform: scale(). Like so
.navi li.active {
background: blue;
color: white;
-ms-transform: scale(1.1); /* IE 9 */
-webkit-transform: scale(1.1); /* Safari */
transform: scale(1.1);
}

Bootstrap Overlay image not responsive

I'm using this CSS Code to make an image overlay on top of a slider in bootstrap but when resizing down the image is not responsive:
.overlay {
background: url(../img/bocSlider.png) top left no-repeat;
position: absolute;
background-position: center;
width: 100%;
height: 100%;
z-index: 10;
pointer-events: none;
}
#media (min-width: 768px) and (max-width: 979px) {
.overlay{
width:50%;
height:50%;
}
}
#media (max-width: 767px) {
.overlay{
width:50%;
height:50%;
}
}
#media (max-width: 480px) {
.overlay{
width:50%;
height:50%;
}
}
Below is the HTML for the slider that I am using:
<div id="myCarousel" class="carousel slide">
<!-- 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>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="overlay" class="img-responsive"></div>
<div class="item active">
<img src="/img/Bar.jpg" class="fill">
</div>
<div class="item">
<img src="/img/Outside.jpg" class="fill">
</div>
<div class="item">
<img src="/img/Table_1.jpg" class="fill">
</div>
<div class="item">
<img src="/img/Tables_2.jpg" class="fill">
</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>
</div>
Could someone please help me fix this issue?
Image is a .png
You can use background color instead of overlay image.
just write
background-color:rgba(0,0,0,.5);
Hope this will help you.
In you css add background size property
.overlay {
background: url(../img/bocSlider.png) top left no-repeat;
position: absolute;
background-position: center;
background-size: 100%;
width: 100%;
height: 100%;
z-index: 10;
pointer-events: none;
}
You are adding class in wrong way and in bootstrap img-responsive applies to img tag,
<div class="overlay" class="img-responsive"></div>
Should be
<div class="overlay img-responsive"></div>
For your code remove img-responsive
<div class="overlay"></div>

fullpage.js background image not covering

I am using fullpage.js with background images but the issue is they are not resizing automatically on page load. They only resize to cover the background when you scale the browser, onload they look very large, cropped and pinned to the upper top. Has anyone had this issue? I am using Chrome.
<div id="fullpage">
<div class="section " id="section0">
<div id="mainTourNav" class="container">
<ul>
<li id="tourNav1"> </li>
<li id="tourNav2" class="tourNav"> Slide 1</li>
<li id="tourNav3" class="tourNav"> Slide 2 </li>
<li id="tourNav4" class="tourNav"> Slide 3 </li>
</ul>
</div>
</div>
<div class="section" id="section1">
<h1>It’s about Friends and Family. . .</h1>
<div class="section" id="section2">
<h1>It's about design. . .</h1>
</div>
<div class="section" id="section3">
<h1>It’s about the game you love. . .</h1>
</div>
</div>
The CSS
/* Backgrounds will cover all the section
* --------------------------------------- */
#section0,
#section1,
#section2,
#section3{
background-size: cover;
}
/* Defining each section background and styles
* --------------------------------------- */
#section0{
background-image: url(../img/Res-BG.jpg);
padding: 15% 0 0 0;
}
#section1{
background-image: url(../img/bg4.jpg);
padding: 10% 4% 0 4%;
}
#section2{
background-image: url(../img/bg3.jpg);
padding: 10% 4% 0 4%;
}
#section3{
background-image: url(../img/bg2.jpg);
padding: 10% 4% 0 4%;
}
#section0 h1{
color: black;
font-size: 40px;
font-style: italic;
opacity: 0;
}
#section{
background-image: url('http://www.fhdwallpapers.com/upload/2013/04/13/20130413064705-280c35c7.jpg');
background-attachment: fixed;
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
}
Got it solved. Basically I chaged:
#section0,
#section1,
#section2,
#section3{
background:cover;
}
to
#section0,
#section1,
#section2,
#section3{
width:100%;
height:100%;
background-size:100% auto;
background-repeat: no-repeat;
}
Add Follwing attributes to section3
#section3{
width:100%;
height:100%;
background-size:100% auto;
background-repeat: no-repeat;
}

Categories

Resources