The disappearance of the Bootstrap carousel on mobile devices has caused confusion for

After following some tutorials, I managed to create a carousel with bootstrap that appears perfectly on my laptop's screen. However, when I switch to my smartphone, the carousel disappears and only the indicator arrows along with the image alt text are visible.

The code looks pretty standard:

<div class="carousel-inner" role="listbox">
                <div class="item active">
                  <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
                  <div class="carousel-caption">
                    <h1>Portfolio1</h1>
                  </div>
                </div>
                <div class="item">
                  <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
                  <div class="carousel-caption">
                    <h1>Portfolio2</h1>
                  </div>
                </div>
                <div class="item">
                  <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
                  <div class="carousel-caption">
                    <h1>Portfolio3</h1>
                  </div>
                </div>
              </div>

I am wondering if there is another CSS class that needs to be added or if adjustments need to be made in the CSS code. Any help would be greatly appreciated!

Thank you in advance.

Answer №1

Did you remember to include the link to the jquery.min file? Alternatively, could you provide the website link?

Answer №2

If you're utilizing the most recent bootstrap 4 beta version, it's important to substitute "item" with "carousel-item".

To see your updated code in action, check out this example carousel here: https://getbootstrap.com/docs/4.0/components/carousel/#with-indicators

<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <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>
<div class="carousel-inner" role="listbox">
            <div class="carousel-item active">
              <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
              <div class="carousel-caption">
                <h1>Portfolio1</h1>
              </div>
            </div>
            <div class="carousel-item">
              <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
              <div class="carousel-caption">
                <h1>Portfolio2</h1>
              </div>
            </div>
            <div class="carousel-item">
              <img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
              <div class="carousel-caption">
                <h1>Portfolio3</h1>
              </div>
            </div>
          </div>
  <a class="carousel-control-prev" 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" 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>

View a live example on Codepen: https://codepen.io/Washable/pen/pWXXje

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

The circular loader in reactstrap Spinner is not displaying as expected

I am attempting to display a loader using the reactstrap (v^7.1.0) Spinner component, but nothing is appearing on the screen. When I inspect the page in Chrome, it seems that the CSS for Spinner is not present. https://i.sstatic.net/uVsRn.png Does anyone ...

Choose the tag that involves an empty text box

I have created a form that pulls data from the database and displays a list of students. However, I am facing an issue with inputting individual scores for each student. The form only allows me to insert one score, which then gets applied to all students i ...

Sending information via HTML on an iPhone

Posting form data on a website typically involves using the following HTML code with a post request: <div id="requestinfo"> <form method="post" action="http://abc/form-post.php" id="request_form"> <input type="hidden" name="fiel ...

Using PHP to generate a table populated with generic elements from an array

How can I create a dynamic table in PHP that can handle any generic array with different keys and values, including nested arrays? I want to use the same table structure for various arrays regardless of their content. Any advice on achieving this flexibili ...

What is the best way to eliminate <p><br></p> tags from a summernote value?

When I try to enter text into the summernote textarea for space, I keep getting this code: <p><br></p><p><br></p><p><strong style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: just ...

What could be causing appendChild to malfunction?

I'm having an issue trying to create three elements (parent and one child) where the third element, an <a> tag, is not appending to modalChild even though it's being created correctly. modal = document.createElem ...

Grid with a column range of 1 to 3 should be used

My website currently features a grid that can have anywhere from 1 to 3 columns. To ensure flexibility in the number of columns, I am using auto-fit: .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min-content, 1fr)); gap: 40px; ...

"Add a new style sheet to the homepage of your WordPress site using the

I have been attempting to utilize a separate style sheet in order to customize the front page of my wordpress website. Despite several attempts, I have not had any success. Below is the current code that I am working with: add_action('wp_enqueue_styl ...

Challenges with Z-index and layering dynamics

I'm having trouble getting z-index to work. I've searched online but can't find a solution. How can I make the .navigation class have a lower z-index than the .mobilenav and .mobilenavclosed classes so that they appear above everything else ...

Adjusting the labels in Datatable.net for optimal viewing size

I have integrated data table.net into my website and encountered an issue with the labels in the status column. The labels for 'in progress', 'assigned', and 'not assigned' are not wrapping properly. I have tried using text-w ...

How about a CSS one-by-one black pixel that's not opaque?

I've been attempting to achieve a 70% transparent black background on an element, but unfortunately, I had to use a pixel to address browser compatibility problems. Using CSS alone would make the entire content of the element transparent as well. Her ...

Font size transition on pseudo elements is not functioning properly in Internet Explorer when using the "em" unit

When I hover over, the font awesome icon and text on this transition increase in size. All browsers work well with this effect except for IE 11. This example demonstrates the same transition using px (class test1) and em (class test2). While using px wor ...

HTML row scaling

I have a table that is set up like this The first row on the left side is adjusting its height based on the content in the "Notes" column. How can I ensure that all rows on the left side have the same height? Here is an example: Check out this fiddle I m ...

Adjust the placement of the content based on the top element's properties

When the content of the <p> tag loads dynamically with varying heights, setting the position of the ion-button fixed at the top using properties like margin-top: -20px; may not work as expected when the p tag contains a large amount of data. How can ...

Tips for resolving the issue of the symbol ' displaying as &#39 in an Angular 2 application

I am currently working on an Angular application that makes API calls when a name displayed in a grid table is clicked. However, I have encountered an issue where names containing an apostrophe are being displayed incorrectly as &#39 instead. I managed ...

Steps to transfer an array from an HTML page to Node.js and subsequently save it in a database

Looking for guidance on how to transfer a JavaScript array using Node.js to MySql. Seeking helpful videos or explanations to clarify the process. Thank you! ...

Do styles operate differently depending on whether they are within the HTML head tags or not?

I am currently working on a project to create a simple website where a div containing text is centered both horizontally and vertically on the page. Despite thinking this would be a straightforward task, I encountered some strange issues. Let's refer ...

The margins are not being maintained by the columns

Currently, I am using Bootstrap 3.3.7 and facing an issue with the alignment of smaller columns in relation to bigger columns. To see a demo, click here. I have set a margin of 10px between the columns. For example, the first row consists of the followin ...

Ways to transfer data to a different PHP file without the need to navigate to the actual page

How can I make a button send information to another PHP folder while staying on the same page? <button class="btn btn-outline-dark w-60"><?php echo "<td> <a href='carrinho.php?acao=adc&id=$PegaID'>Adicionar ...

Updating a div's border using JavaScript

I recently generated a div element dynamically through code. var Element; Element = document.createElement('div'); My goal now is to modify the right and bottom borders to "#CCCCCC 1px solid". I aim to achieve this without relying on any exte ...