I have replicate this code to get 2 column structure in which left side is image carousel and right side is some text, I got the text right but the carousel is not displaying, I am using bootstrap-5 and have linked correct bootstrap css and js, that's verified:
Here is my code:
<section class="tech-area analytics-area" id="analytics-section">
<div class="container-fluid">
<div class="row">
<div class="col">
<!-- carousel goes here -->
<div id="feature-carousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="3" aria-label="Slide 4"></button>
</div>
<div class="carousel-inner active">
<div class="carousel-item">
<!-- first image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img1">
</div>
<div class="carousel-item">
<!-- second image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img2">
</div>
<div class="carousel-item">
<!-- third image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img3">
</div>
<div class="carousel-item">
<!-- fourth image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img4">
</div>
</div>
</div>
</div>
<div class="col">
<!-- Right side text goes here -->
<h1>Best UI UX design with analytical dashboard and more…</h1>
<p>Template provide best designed and user experienced home page and analytical dashboard. Gives
rich feeling and easy use elements action available with different interface design.</p>
<ul>
<li>Menu push content and overlay menu also full screen menu provided.</li>
<li>Sticky Footer iconic footer menu and informative footer for inner page</li>
<li>Dark mode with Different color selection to match your brand and stay with trend.</li>
<li>Customer will get Framework choice with same design to build app.</li>
<li>We have built template with responsive layout grid , It gives small to large phone devices
and UI support back to tablet devices also.</li>
<li>Standard grid systems are easy to customize as per need which adds flexibility components
designs.</li>
</ul>
</div>
</div>
</div>
</section>
You added the active class in the wrong element. Instead of the carousel-inside element, the active class must be used to mark one of the carousel-item elements as the initial active one:
<section class="tech-area analytics-area" id="analytics-section">
<div class="container-fluid">
<div class="row">
<div class="col">
<!-- carousel goes here -->
<div id="feature-carousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
<button type="button" data-bs-target="#feature-carousel" data-bs-slide-to="3" aria-label="Slide 4"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<!-- first image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img1">
</div>
<div class="carousel-item">
<!-- second image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img2">
</div>
<div class="carousel-item">
<!-- third image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img3">
</div>
<div class="carousel-item">
<!-- fourth image -->
<img class="d-block w-100" src="assets/images/FiMobile-1-300x400.png" alt="slider-img4">
</div>
</div>
</div>
</div>
<div class="col">
<!-- Right side text goes here -->
<h1>Best UI UX design with analytical dashboard and more…</h1>
<p>Template provide best designed and user experienced home page and analytical dashboard. Gives
rich feeling and easy use elements action available with different interface design.</p>
<ul>
<li>Menu push content and overlay menu also full screen menu provided.</li>
<li>Sticky Footer iconic footer menu and informative footer for inner page</li>
<li>Dark mode with Different color selection to match your brand and stay with trend.</li>
<li>Customer will get Framework choice with same design to build app.</li>
<li>We have built template with responsive layout grid , It gives small to large phone devices
and UI support back to tablet devices also.</li>
<li>Standard grid systems are easy to customize as per need which adds flexibility components
designs.</li>
</ul>
</div>
</div>
</div>
</section>
Related
Hi Guys I am trying to understand where my problem be (I assume that it has to do with the external API).
I am not sure how if the code so far seems ok, I will share what I have so far:
<!--Carousel-->
<!-- <div id="myCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://pokeapi.co/api/v2/pokemon/2/" class="d-block w-100" alt="active_pokemon">
</div>
<div class="carousel-item">
<img src="https://pokeapi.co/api/v2/pokemon/3/" class="d-block w-100" alt="pokemon">
</div>
<div class="carousel-item">
<img src="https://pokeapi.co/api/v2/pokemon/1/" class="d-block w-100" alt="pokemon">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#myCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#myCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="visually-hidden">Next</span>
</button>
</div> -->
I am not sure if it is required to use the following code in JavaScript, although I thought it would trigger the response:
Carousel
var myCarousel = document.querySelector("#myCarousel");
var carousel = new bootstrap.Carousel(myCarousel);
Am I missing the data slide to = # within the images?
Additionally- the app I am creating should be like a data index which retrieves 150 items (with property and such).
I have set up a carousel to show 5 videos. I have set up indicators at the bottom to navigate:
<div class="col-lg-12 carousel slide" id="trailers" data-bs-ride="carousel" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#trailers" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="1" data-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="2" aria-label="Slide 3"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="3" aria-label="Slide 4"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="4" aria-label="Slide 5"></button>
</div>
<div class="trailerSlider carousel-inner" style="background-color: #000; padding-bottom: 50px;"> <!-- was livetv -->
<div class="carousel-item active" >
<div id="cover">
Loading video...
</div>
</div>
<div class="carousel-item">
<div id="cover2">
Loading video...
</div>
</div>
<div class="carousel-item">
<div id="cover3">
Loading video...
</div>
</div>
<div class="carousel-item">
<div id="cover4">
Loading video...
</div>
</div>
<div class="carousel-item">
<div id="cover5">
Loading video...
</div>
</div>
</div>
</div>
However, even though the indicators show correctly, they don't work, nothing happens when I tap, not even an error message.
If I change data-bs-ride, data-bs-target and data-bs-slide-to to data-ride, data-target and data-slide-to (as I saw in a video tutorial), the buttons do work but the buttons look weird (much smaller and with a white border).
Also, how can I have the slider work only via the indicator buttons and not slide automatically?
You have a duplicate data-bs-ride="carousel" and an extra data-slide-to="1" but I when I ran your code, those errors wouldn’t stop the carousel from working. You didn’t include a working snippet with your question, so it’s not possible to verify which version of Bootstrap 5 you’re using.
Here’s a working snippet using your code.
.carousel-item {
height: 10.5rem;
}
#cover, #cover2, #cover3, #cover4, #cover5 {
color: white;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.bundle.min.js"></script>
<div class="col-lg-12 carousel slide" id="trailers" data-bs-ride="carousel" data-bs-interval="false">
<div class="carousel-indicators">
<button type="button" data-bs-target="#trailers" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="2" aria-label="Slide 3"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="3" aria-label="Slide 4"></button>
<button type="button" data-bs-target="#trailers" data-bs-slide-to="4" aria-label="Slide 5"></button>
</div>
<div class="trailerSlider carousel-inner" style="background-color: #000; padding-bottom: 50px;">
<!-- was livetv -->
<div class="carousel-item active">
<div id="cover">
Loading video 1...
</div>
</div>
<div class="carousel-item">
<div id="cover2">
Loading video 2...
</div>
</div>
<div class="carousel-item">
<div id="cover3">
Loading video 3...
</div>
</div>
<div class="carousel-item">
<div id="cover4">
Loading video 4...
</div>
</div>
<div class="carousel-item">
<div id="cover5">
Loading video 5...
</div>
</div>
</div>
</div>
To prevent the slider from working automatically, add data-bs-interval="false" to the carousel div.
I see the indicators in the carousel where I can click an element to go to the next slider or the previous slider. Is it possible to directly slide to a specified carousel item from controls external to the carousel?
I was trying to add an external panel (to the carousel component) with links to specific slides. I'm trying to do something like the jquery news slider used at easy-quiz.net. This is a jquery extention and have the callback working to change the highlighted item but want to be able to click one of the items and get the carousel to focus on the corresponding item.
The easiest thing to achieve that is to mark up the external controls both with the data-target and the data-slide-to attributes. data-target identifies the carousel by id, while data-slide-to identifies the slide within the carousel with an integer (starting with 0).
Please see the example below with pure Bootstrap 4 markup and without additional javascript.
<div class="d-flex">
<!-- “External” carousel controls -->
<div id="external-controls" class="col-auto btn-group-vertical" role="group" aria-label="External carousel buttons">
<button class="btn btn-primary" data-target="#main-carousel" data-slide-to="0" type="button">First slide</button>
<button class="btn btn-primary" data-target="#main-carousel" data-slide-to="1" type="button">Second slide</button>
<button class="btn btn-primary" data-target="#main-carousel" data-slide-to="2" type="button">Last slide</button>
</div>
<!-- Carousel -->
<div id="main-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="http://placehold.it/400x225/422040/fff?text=Slide+1" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="http://placehold.it/400x225/e57a44/fff?text=Slide+2" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="http://placehold.it/400x225/e3d985/fff?text=Slide+3" alt="Third slide">
</div>
</div>
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
Other than that, you can always use the .carousel(number) method via javascript in order to slide to a specific slide item.
So, in case you would like to create a custom –maybe simpler– markup, you could do so by writing up something as follows.
$('#external-controls').on('click', 'a', function(event) {
event.preventDefault();
// `this` is the clicked <a> tag
// `$.index()` returns the position of `this` relative to its sibling elements
var target = $(this).index();
$('#main-carousel').carousel(target);
})
<div class="d-flex">
<!-- “External” carousel controls -->
<div id="external-controls" class="col-auto btn-group-vertical" role="group" aria-label="External carousel buttons">
<a class="btn btn-primary" href="#">First slide</a>
<a class="btn btn-primary" href="#">Second slide</a>
<a class="btn btn-primary" href="#">Last slide</a>
</div>
<!-- Carousel -->
<div id="main-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="http://placehold.it/400x225/422040/fff?text=Slide+1" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="http://placehold.it/400x225/e57a44/fff?text=Slide+2" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="http://placehold.it/400x225/e3d985/fff?text=Slide+3" alt="Third slide">
</div>
</div>
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
Yes it is Possible, I personally use Revolution slider to achieve this.
Check out this website where I used the carousel: http://4kaststrategies.com/
at the footer of the carousel, you will see a tiny round button where you can navigate to any of the item image you want.
look up the documentation: https://www.themepunch.com/revsliderjquery-doc/slider-revolution-jquery-5-x-documentation/
Did you skip the Carousel With indicators in the documentation? That example is showing you how you can directly slide to a particular item.
The following code is being used to achieve this:
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
Notice the attribute data-slide-to.
<button type="button" data-bs-target="#demo" data-bs-slide-to="0" class="active"></button>
<button type="button" data-bs-target="#demo" data-bs-slide-to="1"></button>
<button type="button" data-bs-target="#demo" data-bs-slide-to="2"></button>
The simple way to use slide carousel using external button or image or anything is :
By using,
data-bs-target="(idname)"
data-bs-slide-to="(array number)"
I wanted my panel heading to contain some text and a button, the former being left-aligned and the latter, right-aligned. But as soon as I apply the class row to my panel header, it breaks out of the parent div and takes up what I believe to be the container width.
Here's the code I'm using:
<div class="panel panel-primary">
<div class="panel-heading row">
<h4 class="col-md-11">Manage Your Subscriptions</h4>
<div>
<a href="#" class="btn btn-default col-md-1" >Log out</a>
</div>
</div>
<div class="panel-body">
</div>
</div>
And here's the result:
How can I correct this?
It seems to me like you just need to move the "row" to be inside the "panel-heading" rather than on the same level, as they both have relative CSS positioning properties. I tried the following code:
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<h4 class="col-md-11">Manage Your Subscriptions</h4>
<div class="col-md-1">
<a href="#" class="btn btn-default" >Log out</a>
</div>
</div>
</div>
<div class="panel-body">
Stackoverflow rocks!
</div>
</div>
and it gave me this output (which is what you're looking for, I hope):
I hope that helps
EDIT: I tried using "pull-right" as others have suggested and it seems to create more troubles as it messes the top/bottom margins as well since it makes the display block relative to container (Which I would generally recommend against doing, even if it works for you).
EDIT2: moved the "col-md-1" class into an encapsulating "div" to solve the button's margins' issue.
May be you need something like following?
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-md-10 col-sm-10">
<h4>Manage Your Subscriptions</h4>
</div>
<div class="col-md-2 col-sm-2">
<a href="#" class="btn btn-default pull-right" >Log out</a>
</div>
</div>
</div>
<div class="panel-body">
</div>
</div>
Let me know if it works
You can use pull-left and pull-right instead of grid system, so the components will be rendered on single line even on small screen (if there is enough space):
<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="pull-left">Manage Your Subscriptions</h4>
<span class="pull-right">
<a href="#" class="btn btn-default" >Log out</a>
</span>
<div class="clearfix"> </div>
</div>
<div class="panel-body">
</div>
</div>
I am using Bootstrap 3. I have one row that will hold a variable amount of columns, ranging from 1-let's say 9.
The are currently set to col-lg-4, so three should display on one row. I would normally create a new row, but since I am dynamically adding columns, I cannot do this, or at least do no know how.
When my client adds a post, it automatically creates a column with content.
The problem lies only in Firefox & IE, in both desktop and mobile views. The 4th item (or 1st item that should go to the next row) gets pushed to a new line and is offset. See screenshot below.
I am using ExpressionEngine as my CMS.
It displays perfectly in Chrome.
Code Below
<div class="container">
<div class="row">
{exp:channel:entries channel="plans" orderby="title" sort="asc"}
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 centered">
<div class="grid mask">
<figure>
<img class="img-responsive" src="{plan_main_image}">
<figcaption>
<h5>{title}</h5>
<a data-toggle="modal" href="#{url_title}" class="btn btn-primary btn-lg">View Floor Plan</a>
</figcaption>
</figure>
</div>
</div>
<div class="modal fade" id="{url_title}" tabindex="-1" role="dialog" aria-labelledby="{url_title}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{title}</h4>
</div>
<div class="modal-body text-left">
<div class="row">
<div class='list-group gallery'>
<div class="col-lg-4">
<a class="thumbnail fancybox-effects-d" data-fancybox-group="" href="{plan_main_image}">
<img class="img-responsive" alt="" src="{plan_main_image}" />
</a>
</div>
<div class="col-lg-4">
<a class="thumbnail fancybox-effects-d" data-fancybox-group="" href="{plan_first_level}">
<img class="img-responsive" alt="" src="{plan_first_level}" />
</a>
</div>
<div class="col-lg-4">
<a class="thumbnail fancybox-effects-d" data-fancybox-group="" href="{plan_second_level}">
<img class="img-responsive" alt="" src="{plan_second_level}" />
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
{plan_description}
</div>
</div>
<!--<div class="row">
<div class="col-lg-12">
<b>Download the floor plan</b>
</div>
</div>-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{/exp:channel:entries}
</div><!-- /row -->
<br>
<br>
</div><!-- /row -->
</div><!-- /container -->
Thanks
The reason for this is because the first image is slightly taller than the other images. You need to use a responsive column reset for this. See Responsive Column Resets in the doc.
The basic concept is to add a div after the each horizontal grouping that contains a clearfix so that the next horizontal grouping is cleared before and aligns correctly.
For more complex scenarios you can see my answer here: Gap in Bootstrap stacked rows.