Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap carousel slider custom arrows

Okay

I'm using bootstraps carousel slider, but with custom images instead of the glyphicons supplied with it.

The problem with it however is that they are positioned towards the edges of the slider. Top left for the left arrow and top right for the right image.

I have tried changing the position, which works, but doesn't stay in their position when the window gets re sized. And i don't know where to target the code so that the code ignores that shadow that appears when hovering over the arrow.

This is the html.

<div class="container-fluid banner_fluid">
    <div class="carousel slide" data-ride="carousel" id="carousel_slider">
        <div class="carousel-inner">
            <div class="item active">
                <img src="images/home_banner_1.jpg" alt="home slide 1" />
            </div>
            <div class="item">
                <img src="images/home_banner_2.jpg" alt="home slide 1" />
            </div>
            <div class="item">
                <img src="images/home_banner_3.jpg" alt="home slide 1" />
            </div>
        </div>
        <div href="#carousel_slider" class="left carousel-control" data-slide="prev">
            <span>
                <img src="images/chevron_left.jpg" />
            </span>
        </div>
        <div href="#carousel_slider" class="right carousel-control" data-slide="next">
            <span>
                <img src="images/chevron_right.jpg" />
            </span>
        </div>
    </div>
</div>

I was using the Developer tools for a quick look and tester for different options. Position absolute does not work. Is there any other way to make it, so they appear in the same position as the original glyphicons and respond too?

Image with the suggested fix on it...The right seems to be only problem though.

The changes made in the code so far is the addition of css and img-responsive in the class of the carousel controls themselves.

------------- banner ----------------*/

 .banner_fluid {
   padding-left:0;
   padding-right:0;
}

.carousel-control {
    position: absolute;
    top: 50%; /* pushes the icon in the middle of the height */
     z-index: 5;
    display: inline-block;

}

The other code i have tried all gave the effect fine but only in desktop view.

like image 876
Reeze Cornelius Avatar asked Dec 02 '14 11:12

Reeze Cornelius


People also ask

How do you change carousel arrow position?

Changing the margin-left and margin-right for the prev and next icons will move them towards left and right respectively. The higher the negative value of margins, the more they will move outside the carousel images.

How do you change the shape of a carousel indicator?

You just need to override two properties ( width and height ) and add a new one, border-radius , to . carousel-indicators li . Make width and height values equal eg: 10px each and give a border-radius of 100% .

How do I add a button to carousel?

Show activity on this post. You can do so by setting the carousel's position to relative and then setting then placing your button within the you want the button to appear in. After that is done, you should set the buttons position to absolute.

How do I display Bootstrap carousel with three posts in each slide?

Following are the steps to create a Bootstrap carousel:Apply CSS to resize the . carousel Bootstrap card body by using the code segment below. In this step, the sliding images are defined in the division tag as under. Last step is to add controls to slide images using the carousel-control class as below.


1 Answers

add this into your CSS file:

.carousel-control {
position: absolute;
top: 50%; /* pushes the icon in the middle of the height */
z-index: 5;
display: inline-block;
}
like image 165
stylesenberg Avatar answered Sep 22 '22 18:09

stylesenberg