Developing a Cutting-Edge 3D Waterwheel Carousel with Bootstrap

I am interested in building a waterwheel carousel design where the middle item is slightly larger than the previous and next items. I have figured out how to create the carousel using cards, but adjusting the size of the middle item is proving to be challenging.

Here is the code snippet I initially used:

Any assistance on this matter would be greatly appreciated.

Answer №1

Utilizing this CSS class may be beneficial:

.carousel-item.active .col-md-4:nth-child(2) img {
    border: 1px solid red !important;
    transform: scale(1.5);
    position:absolute;
    z-index: 2;
}

Including the complete snippet:

$('#recipeCarousel').carousel({
  interval: 10000
})

$('.carousel .carousel-item').each(function() {
  var minPerSlide = 3;
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));

  for (var i = 0; i < minPerSlide; i++) {
    next = next.next();
    if (!next.length) {
      next = $(this).siblings(':first');
    }

    next.children(':first-child').clone().appendTo($(this));
  }
});
@media (max-width: 768px) {
  .carousel-inner .carousel-item>div {
    display: none;
  }
  .carousel-inner .carousel-item>div:first-child {
    display: block;
  }
}

.carousel-inner .carousel-item.active,
.carousel-inner .carousel-item-next,
.carousel-inner .carousel-item-prev {
  display: flex;
}


/* display 3 */

@media (min-width: 768px) {
  .carousel-inner .carousel-item-right.active,
  .carousel-inner .carousel-item-next {
    transform: translateX(33.333%);
  }
  .carousel-inner .carousel-item-left.active,
  .carousel-inner .carousel-item-prev {
    transform: translateX(-33.333%);
  }
}

.carousel-inner .carousel-item-right,
.carousel-inner .carousel-item-left {
  transform: translateX(0);
}

.carousel-item.active .col-md-4:nth-child(2) img {
  border: 1px solid red !important;
  transform: scale(1.5);
  position: absolute;
  z-index: 2;
  left: 0%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<div class="container text-center my-3">
  <h2 class="font-weight-light">Bootstrap 4 - Multi Item Carousel</h2>
  <div class="row mx-auto my-auto">
    <div id="recipeCarousel" class="carousel slide w-100" data-ride="carousel">
      <div class="carousel-inner w-100" role="listbox">
        <div class="carousel-item active">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=1">
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=2">
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=3">
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=4">
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=5">
            </div>
          </div>
        </div>
        <div class="carousel-item">
          <div class="col-md-4">
            <div class="card card-body">
              <img class="img-fluid" src="http://placehold.it/380?text=6">
            </div>
          </div>
        </div>
      </div>
      <a class="carousel-control-prev w-auto" href="#recipeCarousel" role="button" data-slide="prev">
        <span class="carousel-control-prev-icon bg-dark border border-dark rounded-circle" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a>
      <a class="carousel-control-next w-auto" href="#recipeCarousel" role="button" data-slide="next">
        <span class="carousel-control-next-icon bg-dark border border-dark rounded-circle" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>
  </div>
  <h5 class="mt-2">Advances one slide at a time</h5>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trigger a jQuery directive in Angular once the view has completed rendering

I recently implemented a custom masonry layout jQuery plugin which has been working wonderfully. My current challenge is to integrate it with Angular. Below is the code snippet I have so far: app.directive('coursegridjs', function() { return ...

How can I send extra information along with my Ajax request in jQuery UI Autocomplete?

I currently have two jQuery UI Autocomplete widgets set up. The first autocomplete allows the user to enter a client's name, narrowing down options until the correct client is selected. A callback function then takes the ID of the chosen client and st ...

Transferring array data between two distinct click actions

Is there a way to transfer values between click events in jQuery? For example, on the first click event I want to add or remove values from an array based on whether a checkbox is checked. Then, on the second click I would like to iterate through all the ...

How can we efficiently load a JSON file from a local path into an HTML document in a way that is compatible with all browsers?

I am attempting to retrieve JSON data from a local path and display it on a basic HTML page. I have tried various methods such as fetch, ajax in order to load the data and update the corresponding values on the web page. The goal is to host this page so t ...

Tips for successfully incorporating PHP dynamic parameters separated by commas into a JavaScript onclick function

How can I pass PHP dynamic parameters separated by commas to a JavaScript onclick function? Can someone assist me with the correct solution? The code below is not working as expected. echo "<td><a href='#' onclick='editUser(". $row ...

What is the best way to position an SVG background image at the bottom of a container?

I am facing an issue with using an SVG as a background-image on a pseudo element. The image is not as tall as the container, so I would like to position it at the bottom of the container while having the background color fill up the top portion to create a ...

Hide elements inherited by a child using jQuery

I'm experiencing a unique jquery challenge. I want a sticky submenu to be hidden when I hover over another parent to show a submenu, and then reappear when I'm not hovering over another parent with a submenu. While this functionality works as exp ...

Achieving full table height with a parent having a min-height requirement

Encountering a seemingly straightforward issue where I am unable to make an inner div 100% height of the parent div, which is set with min-height 70vh. My goal is to have the table inside be 100% height and content vertically aligned. It currently works if ...

What is the method to capture the change event in a datalist element?

Currently working with a datalist, I am in need of detecting when a user selects an option from the drop-down list. Although a similar question has been brought up, my requirement is for the event to only trigger when the user actually makes a selection fr ...

Tips for choosing an element using a series of ids in jQuery

I am facing an issue with my HTML code. Here is the snippet: <div id="outer"> <div id="inner">...</div> </div> Previously in Prototype, I could easily select the inner div by its ID like this: $('#outer #inner'); H ...

When the window is resized, the scrollTo function switches its direction

Visit Avalon at eaw.com I recently implemented a horizontal scrollTo script that was working perfectly. However, I noticed that whenever the window is resized, the scroll direction changes from horizontal to vertical. Can anyone offer a solution to this i ...

What is the best way to create clickable dynamic HTML table data using jQuery?

I'm fairly new to this, but I've managed to successfully create an HTML table dynamically using jQuery. Below is the code that I used: Is there a way to make the table data (value.id) clickable so that it can redirect to a different page? $(d ...

Employing a variable within an input validation process in JavaScript

The input with the name alternativa-*** will have the *** replaced in the preceding PHP code. I am not using a PHP form, only an onClick statement that calls the function respondeQuestao. However, it appears that this code is not functioning correctly. D ...

Having trouble locating the stylesheet for import

Currently utilizing bootstrap and sass, along with Nodejs and grunt. File: app.sss $icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/"; $fa-font-path: "/bower_components/font-awesome/fonts"; $header-height: 50px; ...

What is the best way to show a message on a webpage after a user inputs a value into a textbox using

I have a JSFiddle with some code. There is a textbox in a table and I want to check if the user inserts 3000, then display a message saying "Yes, you are correct." Here is my jQuery code: $("#text10").keyup(function(){ $("#text10").blur(); ...

Place the file in the designated area for styling purposes

Within the pluploader, a file drop zone exists with the identifier dropFilesHere; var uploader = new plupload.Uploader({ drop_element : "dropFilesHere", /*...*/ }); If a user hovers a file over the drop zone, I want to customize it* ...

Difficulty in centering certain elements using Bootstrap

I have recently constructed an element for a webpage within the site I am developing. The item is complete, but I am struggling to center it on the page properly. While I can easily center the image, the text associated with it refuses to budge. Here is t ...

Customize the appearance and text in the navigation bar

Currently, I am in the process of creating my own personal website template. However, I have encountered an issue with styling the image and text within the navbar. I am looking to adjust the aspect ratio of the image in order to center it within the n ...

Can anyone provide assistance with understanding the background-size property?

I am struggling to resize the background image on my website, similar to the one on this website. No matter what I try with the position or background-size property, the image remains too large and does not adjust properly. Additionally, I need the image t ...

Utilizing multiple class names in Material UI with identical definitions

When working with traditional CSS, it is common to define shared properties between classes like this: .classA,.classB{ background-color: black; } In Material UI and using theming, the equivalent would be: styles = (theme)=>({ classA:{ ba ...