Guide on syncing Bootstrap 4 sliders using a single set of controls

Is it possible to synchronize a bootstrap 4 carousel with controls to a carousel without any controls?

1) When the control arrows are clicked, both carousels will slide simultaneously.

2) Hovering over either carousel will pause both carousels from sliding automatically.

3) When neither carousel is being hovered over, they will slide together automatically at the same interval.

Here is the layout of the two carousels. They are both placed within an equal-width column inside a row. The right carousel (without controls) contains descriptive text corresponding to the images displayed on the left carousel.

Layout

I have attempted a few solutions from StackOverflow without success.


<div class="col-6 p-5 text-center">
<div id="carouselExampleIndicators" class="carousel slide py-5 mb-4 carousel-sync" data-ride="carousel" >
    <ol class="carousel-indicators">
       <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active mt-3 mx-2"></li>
       <li data-target="#carouselExampleIndicators" data-slide-to="1" class="mx-2 mt-3"></li>
       <li data-target="#carouselExampleIndicators" data-slide-to="2" class=" mx-2 mt-3"></li>
    </ol>
      <div class="carousel-inner">
         <div class="carousel-item active">
            <img class="d-block w-100" src="images/img1.jpg" alt="First slide">
         </div>
         <div class="carousel-item">
            <img class="d-block w-100" src="images/img2.jpg" alt="Second slide">
         </div>
         <div class="carousel-item">
           <img class="d-block w-100" src="images/img3.jpg" alt="Third slide">
         </div>
      </div>
      <a class="carousel-control-prev carousel-control" href="#carouselExampleIndicators" 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 carousel-control" href="#carouselExampleIndicators" role="button" data-slide="next">
         <span class="carousel-control-next-icon" aria-hidden="true"></span>
         <span class="sr-only">Next</span>
      </a>
</div>

</div>

<div class="col-6 align-middle">
<div id="carouselExamplSlidesOnly" class="carousel slide carousel-sync" data-ride="carousel" >
   <div class="carousel-inner">
      <div class="carousel-item active carouseltext">
         Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies, velit ut sollicitudin ultricies, diam ipsum interdum nisi, non imperdiet libero tellus id enim. Etiam venenatis vulputate massa, luctus fringilla tellus accumsan a. Donec varius gravida efficitur. In eu nibh dui. Vivamus maximus libero dui, id congue nisl viverra sed. Nam vitae bibendum lectus. Pellentesque sed ligula at metus facilisis cursus.
      </div>
      <div class="carousel-item carouseltext">
         Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies, velit ut sollicitudin ultricies, diam ipsum interdum nisi, non imperdiet libero tellus id enim. Etiam venenatis vulputate massa, luctus fringilla tellus accumsan a. Donec varius gravida efficitur. In eu nibh dui. Vivamus maximus libero dui, id congue nisl viverra sed. Nam vitae bibendum lectus. Pellentesque sed ligula at metus facilisis cursus.
      </div>
      <div class="carousel-item carouseltext">
         Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies, velit ut sollicitudin ultricies, diam ipsum interdum nisi, non imperdiet libero tellus id enim. Etiam venenatis vulputate massa, luctus fringilla tellus accumsan a. Donec varius gravida efficitur. In eu nibh dui. Vivamus maximus libero dui, id congue nisl viverra sed. Nam vitae bibendum lectus. Pellentesque sed ligula at metus facilisis cursus.
      </div>
   </div>
</div>
</div>

Answer №1

Coming up with a creative solution here, especially when dealing with carousels that have the same number of slides:

  1. Set up a single carousel
  2. Each carousel item will represent the entire layout depicted in your image
  3. Adjust the arrow positions by customizing the CSS

Hopefully, this suggestion proves to be useful for your situation

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

Encountering a type error when making an Ajax request in JavaScript/jQuery

Encountering an error while trying to extract a value within a loop using jQuery. The error message is displayed below. Uncaught TypeError: Cannot read property 'no_of_optional' of undefined Below is the code I am working with. var data = $.pa ...

JavaScript allows for inserting one HTML tag into another by using the `appendChild()` method. This method

My goal is to insert a <div id="all_content"> element into the <sector id="all_field"> element using Javascript <section id="all_field"></section> <div id="all_content"> <h1>---&nbsp;&nbsp;Meeting Room Booki ...

Is a Selenium loop a viable option?

</head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">test</td></tr> </thead><tbody> <tr> <td>click& ...

What is the correct way to align an InputLabel in Material UI?

https://i.stack.imgur.com/Uafr1.png Looking for advice on styling the InputLabel in my code to improve its appearance. Code snippet below: <FormControl fullWidth> <InputLabel >Select EPE</InputLabel> <Select ...

Saving data in HTML using PHP and then downloading it

Currently, I am tackling a project involving a website that is connected using PHP. The main function of the PHP script is to modify an HTML file stored on the server and then allow the user to download it. I attempted to use PHP DOM for this task but unf ...

"Enhance Your Website with Javascript: Combining and Incorpor

I'm struggling to assign the selected attribute to the option value that is already rendered within the object. However, despite the values being equal, the selected attribute is not being added. Could this issue be related to the appending process? ...

JSP checkbox functionality

I have been attempting to solve this issue since last night, but I am struggling and need some help. There are two pages, named name.jsp and roll.jsp. In name.jsp, there are two input text boxes and one checkbox. After entering data in the text boxes and ...

Issues with PHP Mail Forms not functioning as intended

I've been struggling for hours trying to figure this out. I'm new to PHP mail form coding and any assistance would be greatly appreciated! Below are two images: one of the HTML code and one of the PHP code. It seems like a simple setup, but even ...

Achieving unique proportions with HTML5 video resizing

On my page, I plan to showcase a video specifically for desktop browsers. I have devised some code to determine whether the video is in landscape or portrait orientation. The challenge lies in deciding what to do based on this orientation: If the video is ...

Using the swiper carousel on WordPress results in an unexpected horizontal scrolling issue

Running an Elementor website, I need to incorporate various image carousels within my post content. Initially, I created a template for each carousel using Elementor. However, I have now decided to switch to utilizing a shortcode that leverages Elementor&a ...

What are some techniques for applying CSS styling directly to a custom element?

Check out this amazing resource from HTML5 Rocks about the process of creating custom elements and styling them. To create a custom element, you can use the following code: var XFoo = document.registerElement('x-foo', { prototype: Object.crea ...

The label element in a CSS form is not displaying correctly

After clicking submit on the form located at this link: I am experiencing an issue where the validation messages are not displaying as intended. I would like them to appear next to the input elements, inline with the form. I suspect that there may be a p ...

Accordion jQuery failing to display tabs

I have a question about using 2 jQuery accordions with tabs inside them. Everything seems to be working, but when I try to expand the second accordion, the two tabs inside don't render properly. I'm not sure what the issue is. Any help on this wo ...

Transitioning the image from one point to another

I am currently working on a unique single-page website and I have been experimenting with creating dynamic background animations that change as the user scrolls. Imagine my website is divided into four different sections, each with its own distinct backgro ...

The Mystery of jQuery Isotope Plugin: Why Can't I Add "display:none" Inline?

I'm currently in the process of integrating Isotope into my latest Wordpress theme. However, I've encountered an issue where it's not appearing on the page due to some external factor adding an inline style (display:none) to the main isotope ...

Is there something I'm overlooking when it comes to vue router transitions?

I am attempting to implement a smooth transition between my Vue components with the following code: <template> <div id="app"> <router-link to="/">Go to home</router-link> <router-link to="Register">Go to register< ...

Easily toggle between various image source paths

In my current application, all HTML files have hardcoded relative image paths that point to a specific directory. For example: <img src="projectA/style/images/Preferences.png"/> Now, I am considering switching between two different project modes: & ...

Looking for guidance on integrating cookies with express session? Keep in mind that connect.sid is expected to be phased out

Within my app.js file, I have the following code snippet: app.use(session({secret: 'mySecret', resave: false, saveUninitialized: false})); While this setup functions correctly, it triggers a warning message: The cookie “connect.sid” will ...

App builder shows raw HTML code instead of generating a dynamic table

I am currently working on an application that requires gathering data in a csv format from Google Sheets and importing it into App Inventor. Additionally, I need to include HTML code to display the table in a more visually appealing way. Here is what the ...

Tips for including HTML tags in strings without causing issues with nested tags

I am struggling with a string that contains both text and HTML tags, specifically <a href=""></a> tags. My goal is to apply the "i" tag around the text outside of the "a" tags without creating nested tags like: <i><a href=""></a ...