Troubleshooting Safari compatibility problems with Bootstrap 4's full-screen modal and carousel

I have successfully created a Bootstrap 4 modal with a full-screen images carousel experience. The images are set to always be fully visible, centered both vertically and horizontally, with max-height: 100%; and max-width: 100%;.

While this setup works flawlessly on Chrome and Firefox, it seems to encounter issues when viewed in Safari (Version 12.1.2 (14607.3.9) on macOS). For some reason, the images do not display properly and appear to have no size.

The images fail to load as expected on Safari and I'm currently unable to determine the cause of this issue.

.modal-full {
  width: 100vw;
  height: 100vh;
}
.modal-full .modal-dialog {
  margin: 0;
  height: 100%;
}
.modal-full .modal-content {
  width: 100vw;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
}
.modal-full .modal-content .modal-body {
  padding: 0;
}
.modal-full .modal-content .carousel {
  height: 100%;
}
.modal-full .modal-content .carousel-actions {
  height: 100px;
  width: 100%;
  position: relative;
}
.modal-full .modal-content .carousel-inner {
  height: 100%;
}
.modal-full .modal-content .carousel-inner > .carousel-item {
  height: 100%;
  top: 0;
}
.modal-full .modal-content .carousel-inner > .carousel-item > img {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  max-height: 100%;
  max-width: 100%;
  display: block;
  margin: 0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<a href="#" class="gallery-to-carousel btn btn-primary" data-toggle="modal" data-target="#portfolioModal">
  Open modal
</a>

<!-- Modal -->
<div class="modal modal-full fade" id="portfolioModal" tabindex="-1" role="dialog" aria-labelledby="portfolioModalLabel" aria-hidden="true">

  <div class="modal-dialog" role="document">

    <div class="modal-content">

      <div class="modal-body">

        <div id="portfolioCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
        
          <div class="carousel-inner">

              <div class="carousel-item active">
                <img src="https://via.placeholder.com/1200x800">
              </div>
              <div class="carousel-item">
                <img src="https://via.placeholder.com/800x600">
              </div>
              <div class="carousel-item">
                <img src="https://via.placeholder.com/400x800">
              </div>
              <div class="carousel-item">
                <img src="https://via.placeholder.com/2000x400">
              </div>
              
          </div>

          <a class="carousel-control-prev" href="#portfolioCarousel" 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" href="#portfolioCarousel" 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>
  </div>
</div>

If you wish to view a working demonstration, please visit the following link: https://jsfiddle.net/upsidown/t9kwdeur/

Answer №1

If you're having trouble with the display of your .carousel in Safari, try changing the height attribute to 100vh instead of 100%.

.modal-full .modal-content .carousel {
  height: 100vh;
}

Check out the updated fiddle here

Alternatively, you can also set the parent element's height by adding height: 100%; to the .modal-body class.

.modal-full .modal-content .modal-body {
  padding: 0;
  height: 100%;
}

View the second updated fiddle here

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

What is the optimal strategy for managing multilingual text in a React website?

As I develop a react website with multiple localizations, I am faced with the question of how to best store UI texts for different languages. Currently, I am contemplating two approaches: One option is to store text directly in the UI code, using an objec ...

"Implementing a JavaScript function to dynamically add multiple div elements to a

I am just starting to learn JavaScript. The main div with the ID "row_logic" contains two nested divs. I need help figuring out how to dynamically increment this root div in the format shown below using JavaScript. <div class="row-fluid" id="row_log ...

Guide to dynamically add tr element using CSS to a table

While using the $.each function in jQuery, I am retrieving data and adding it to a table in the following manner: $.each(segment, function (index, innerSegment) { var tr; tr = $('<tr/>'); tr.append("<td>" + segment[i].Airline.Air ...

Using CSHTML, CSS, and Bootstrap to create nested tabs within tabs

I have a set of two tabs: boys and girls. Within each tab, there are dropdown options for different age groups. My goal is to display the selected age group under either the 'boys' or 'girls' tab. For example, if I choose 17-18, I wa ...

Selecting CSS tag excluding the first-child element

My goal is to use CSS to target the li elements in a list that do not have a description and are not the first-child with a b element. I want to apply padding-left to these specific li elements that do not have a title. <ul> <li><b>t ...

The menu bar becomes distorted when the page is zoomed out

Hey everyone, I could really use some assistance with my menus. Whenever I zoom out of the page, they become distorted. Here is the link to my website: https://dl.dropbox.com/u/22813136/Finding%20Nemo%20Inc/FNemo_front.htm# I tested the link on Internet E ...

Shining animation of a quote in a right angle using CSS3 and/or Javascript

I have a vision for an animation that involves three successive right angle quotes, like » » », glowing one after the other from left to right and then back again. This could be a unique effect that developers might find interesting and v ...

What is the best way to import MySQL data into a jQuery datatable within an Electron application?

Currently, I am in the process of developing an Electron app that utilizes a localhost server with a MySQL database and the jQuery datatable plugin. My main challenge lies in loading the data from the MySQL database into the datatable. Although I have suc ...

I need to display a VARCHAR variable retrieved from PHP in a visually appealing way with HTML/CSS. What is the best way to automatically format it to prevent it from appearing as one long, uninterrupted sentence?

Is there a way to automatically format the text retrieved from a VARCHAR variable in a MySQL database via PHP so that it displays correctly with line breaks? Currently, when I display it on an HTML page, it appears as one long string. I've considered ...

Run JavaScript code before finalizing the "submit" action within a Ruby on Rails application

Having trouble with utilizing old JS scripts found on Stack Overflow. <div class="form-actions"> <%= f.button :submit, class:"btn btn-success create-campaign" %> </div> The submit button is causing an issue for me. <div clas ...

Is there a way to attach a JavaScript event to a textarea without directly accessing it?

I am curious about how to incorporate the following code: onblur="hcb.watermark.blur(event)" onfocus="hcb.watermark.focus(event)" style="color: rgb(136, 136, 136); into a textarea with the id "HCB_textarea" and the class "commentbox hcb-shadow-r," withou ...

Snapping a photo from the webcam for your profile picture

Is there a way to capture images using a webcam and upload them to a server in a PHP & Mysql application? I've been searching on Google but only find outdated code that is not supported in all browsers. Here are some links you can check out for more ...

Guide on reverting Bootstrap from version 4 to version 3

I've encountered a challenge while working on a project that utilizes bootstrap 4 - I need to downgrade the version to 3 without sacrificing the website's functionality. Can anyone provide guidance on how to achieve this task effectively? ...

Update the table in GSP using the controller

Currently in my Grails project, I have a GSP page with a JQuery table that has buttons to add and remove rows. The code for this was taken from the tutorial on here. I successfully saved the table values into the database using the relevant controller&apo ...

Is there a method to delay the loading of a webpage until an image has fully loaded (preloading)?

How can I ensure that an image used in a preloader is loaded before the other contents on my website? <div class="overlay" id="mainoverlay"> <div class="preloader" id="preloader"> <img src="images/logo128.png" id="logo-p ...

What are some ways to customize the appearance of Stripe credit card form fields?

I've successfully implemented stripe using this HTML code and Bootstrap 4. <div class="form-control" id="card-element"></div> As a result, I get the displayed output: https://i.sstatic.net/Aw653.png However, I am loo ...

Getting the value of a variable and displaying it within a `<p>` paragraph by utilizing getElementById.innerHTML in Javascript

Can someone please help me with my JavaScript Blackjack code? I have all the logic in place, but I'm struggling to display the results in an HTML paragraph using getElementById.innerHTML. Here's the code I have so far and any assistance would be ...

Choosing a specific row in Angular 5

I'm completely new to Angular, so please bear with me :) I have a collection of user data that is presented in the following format: https://i.sstatic.net/5UAIP.png Below is my current HTML structure: EDIT - ADDED CRUD BUTTONS : <!--Add ...

Issue when attempting to update the background image using d3.js in browsers other than Firefox

I am experiencing a strange error that is puzzling to me. What I have done is placed a background image (SVG file) in a div using CSS. This SVG is used to create a Sprite animation, which is functioning correctly. .runner { background: url("0804_ ...

Steps to divide input form data and transmit it to MySQL

I am currently facing a challenge with my form, as it works perfectly when making calls to the server. However, I would like to enhance its functionality by allowing it to handle multiple input codes submitted by users. My main question is how can I modi ...