Adjusting the visibility and z-index of HTML5 video controls

Hello, I am facing an issue with a Bootstrap carousel that contains a video. The main problem is that the video controls cannot be clicked due to the carousel indicators overlaying them. I have tried adding margin and padding to the indicators, which worked at the beginning and end of the video, but there is still an area in the middle where clicking doesn't register for some reason. If my explanation is unclear, please let me know. I am unable to provide a code snippet here, but you can view the issue on my website: Here

HTML:

<div id="carousel-home" class="carousel slide carousel-fade" data-ride="carousel" data-interval="false">
  <ol class="carousel-indicators">
    <li data-target="#carousel-home" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-home" data-slide-to="1" id="slide_1"></li>
    <li data-target="#carousel-home" data-slide-to="2" id="slide_2"></li>
    <li data-target="#carousel-home" data-slide-to="3" id="slide_3"></li>
  </ol>

  <div class="carousel-inner" role="listbox">
    <div class="carousel-item active">
      <video id="myvideo" class="crop" poster="imgs/video_thumb.jpg"  preload="auto" playsinline controls>
        <source src="vid/video_2019.mp4" type="video/mp4"  onclick="this.play();">
      </video>
    </div>

    <div class="carousel-item">
      <img class="d-block w-100 mx-auto" src="imgs/slider/1.png" alt="First slide">
      <div class="carousel-caption">
        <h2 class="title" style="text-shadow: 1px 1px black">First</h2>
      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100 mx-auto" src="imgs/slider/2.png" alt="Second slide">
      <div class="carousel-caption">
        <h2 class="title" style="text-shadow: 1px 1px black">Second</h2>
      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100 mx-auto" src="imgs/slider/3.png" alt="Third slide">
      <div class="carousel-caption">
        <h2 class="title" style="text-shadow: 1px 1px black">Third</h2>
      </div>
    </div>
  </div>
  <a class="carousel-control-prev" href="#carousel-home" role="button" data-slide="prev" id="carousel_l">
  <i class="fa fa-chevron-left"></i>
  <span class="sr-only">Back</span>
  </a>
  <a class="carousel-control-next" href="#carousel-home" role="button" data-slide="next" id="carousel_r">
  <i class="fa fa-chevron-right"></i>
  <span class="sr-only">Next</span>
  </a>
</div>

CSS:

   .carousel-indicators li {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    padding-top: 1rem;
    border-radius: 100%;
  }
    .carousel-item img {
  object-fit: cover
}

.carousel-item {
  overflow:hidden;
}

JQuery:

$(window).ready(function() {
$('#carousel_l').on("click", function() {
  $('#myvideo').get(0).pause();
});
$('#carousel_r').on("click", function () {
  $('#myvideo').get(0).pause();
});
$('#slide_1').on("click", function () {
    $('#myvideo').get(0).pause();
});
$('#slide_2').on("click", function () {
    $('#myvideo').get(0).pause();
});
$('#slide_3').on("click", function () {
    $('#myvideo').get(0).pause();
});

});

Answer №1

If you want to disable interaction with the carousel indicators, you can accomplish this by using the following CSS code:

    .carousel-indicators {
      pointer-events: none;
    }

    .carousel-indicators > li {
      pointer-events: auto;
    }

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

Custom Jquery function is failing to position divs correctly within ajax-loaded content

I recently coded a custom function that efficiently positions absolute divs within a container by calculating top positions and heights: $.fn.gridB = function() { var o = $(this); //UPDATED from var o = $(this[0]); o.each(function() { var ...

Explore our Enhanced Django Search Page featuring Efficient Query Pagination!

Hello, I recently set up a basic search form and search view to display search results. I now want to incorporate pagination, but I've run into an issue with the URL structure. Currently, my search URL looks like ../search?q=Bla When attempting to ad ...

Developing a personalized file upload button in React

I have been working on creating a custom <input type="file"> upload button in React. My goal is to display the name of the uploaded file on the button itself after the upload. I encountered some challenges while trying to create a codepen demo, so I ...

What is the process for modifying input text and saving it for future use?

Is it possible to create an input field where users can change their name and have the new string stored as a username? I attempted to achieve this using form, but encountered the following error: Error: Template parse errors: Can't bind to 'form ...

Is there a way to align these side by side?

Is it a silly question? Perhaps. But I can't seem to figure out how to align my text and colorpicker on the same line instead of two. Take a look at my fiddle. I've tried removing display:block and clear:both, but that didn't do the trick. H ...

Is there a problem with css3 opacity transition in Webkit browsers?

While exploring alternative ways to modify the Bootstrap 3 carousel, I stumbled upon a technique that achieves a 'fade' effect instead of the usual 'slide'. However, in webkit browsers, the transition may appear choppy or flicker betwee ...

Tips on Including Static Header and Footer in Multiple HTML Pages

What is the best way to reuse a header and footer on multiple HTML pages without repeating code? I have 5 HTML pages that all need to include the same header and footer elements. How can I efficiently reuse these components across all pages? ...

Bizarre Incident Management

My latest project involves a simplistic website featuring arrow images (png) positioned on the left and right sides with fixed placement, allowing users to navigate to the next page. However, an issue arises where the cursor seems unable to select the an ...

Django - issue with table display showing empty row due to query set

In my project, I have two models: one named Season and the other one named Game: # Season class Season(models.Model): teams = models.ManyToManyField('Team', related_name='season_teams', blank=True) current = models.BooleanF ...

Adjusting the height of a div based on the height of the window

Here is the HTML structure I am working with: <body> <div class="header">header</div> <div class="content"> hello </div> <div class="footer">footer</div> </body> This is the current ...

How can we assign priority to the child element for detection by the "mouseover" event in jQuery?

Can you help me figure out how to make the "mouseover" event prioritize detecting the child element over its parent? This is the jQuery code I've been using: <script> $(function() { $("li").mouseover(function(event){ $('#log&a ...

The parent's height remains unaffected by the margins of its child element

My code snippet is concise: .parent{ box-sizing: border-box; } .child{ height: 100px; margin: 20px; background: red; } .a1{ background: green; } <!DOCTYPE html> <html> <head> </head> <body> ...

Updating a div periodically with Ruby on Rails: The ultimate guide to implementing Ajax or alternative techniques

In my show.html.erb file, I have a div (with id "mydiv") that needs to be updated every few seconds with data from the server. To accomplish this, I am using AJAX with setInterval to fetch the latest information from the backend. However, I am unsure of ho ...

css issues with setting background colors

I am in the process of updating the header on a website, and I want the entire header to have a light gray background. My initial approach was to set the background-color of the main header div to gray (E7E7E7), but for some reason, there is now a white sp ...

Obtaining the parent value of <LI> tag: A step-by-step guide

Let's consider a scenario where there is a list structured as follows: <ul id='left_faq_tips_navi'> <li>Test <ul> <li>A</li> <li>B</li> </ul> </li> <li>T ...

Transforming HTML content in real-time using Express.js

I'm a little uncertain if I understand the concept of Express MVC correctly: If my goal is to create a single page application and dynamically modify the HTML, can Express assist me with this? Or will I only be able to work with static pages that req ...

Change the height of textarea dynamically using jQuery

I am trying to create a comment box similar to Facebook's, where it resizes as text fills it using Expanding Text Areas Made Elegant This is how my view looks: <div class='expandingArea'> <pre><span></span></ ...

Creating a table with adjustable row heights is a great way to enhance the user

Can the height of an HTML table row be adjusted dynamically by dragging and dropping, similar to how it's done in this demo (https://reactdatagrid.io/docs/row-resize), but for free? ...

Merge multiple echoes to create a single echoed string that is valid HTML

<?php // link to Google Docs spreadsheet $url='https://docs.google.com/spreadsheets/d/1_4d-MPxTUOVZbxTOlhjXv1ebTlBPQ-_JrYUlS1rqX5Q/pub?output=csv'; // open file for reading if (($handle = fopen($url, "r")) !== FALSE) { while (($data = fge ...

Exploring GitHub's sleek popup: in search of CSS styling!

Exciting news from Github: they have introduced a new feature called maps. This feature is developed using Leaflet, and it has some unique custom CSS for the pop-up design: I'm eager to implement something similar on my site, but I'm having trou ...