What causes pagination to be displayed outside of the main section in Firefox when using swiper?

When using swiper, why does pagination display outside of the main section in Firefox when inserting slides with different content lengths? This issue seems to only occur in Firefox and not in other browsers like Chrome. I have noticed that using two bootstrap 4 columns may be causing a height problem in Firefox but works fine in Chrome. Any help would be appreciated. Thanks in advance.

Please refer to my attached image to see the issue in Firefox.

Issue with slide containing short content: https://i.sstatic.net/4wgah.jpg

No issues with slide containing large content: https://i.sstatic.net/JPeSd.jpg

        var swiper = new Swiper('.swiper-container', {
            slidesPerView: 1,
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
        });
.slider-content {
                background-color: #000;
                padding: 10%;
                color: #fff;
            }
            .slider-content h1 {
                margin-bottom: 30px;
            }
            .slider-content p {
                font-size: 18px;
                line-height: 26px;
            }
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
        <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/js/swiper.min.js'></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<section class="custom-slider">
            <div class="container-fluid">
                <div class="row">
                    <div class="swiper-container">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                    <h1>What is Slide 01?</h1>
                                    <p>Lorem Ipsum is simply dummy text of the prin, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
                                    <p>Letraset sheets containing desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                    <h1>What is Slide 02?</h1>
                                    <p>Lorem Ipsum is </p>
                                    <p>Letraset sheets including versions of Lorem Ipsum.</p>
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                    <h1>What is Slide 03?</h1>
                                    <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                        </div>
                        <!-- Add Pagination -->
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </div>
        </section>

Answer №1

the issue lies in the varying amount of content on different slides, with the first slide having more content than the others. To address this problem, follow these steps:

  • Remove padding: 10%, and instead add display: flex and align-items: center to the .slider-content class.
  • Utilize flex to adjust the content to the center.
  • Enclose the content within a div.
  • Assign a min-height to the .swiper-slide.

var swiper = new Swiper('.swiper-container', {
            slidesPerView: 1,
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
        });
.slider-content {
                background-color: #000;
                /*padding: 10%;*/
                color: #fff;
                display: flex; /* Added */
                align-items: center;
            }
            .slider-content h1 {
                margin-bottom: 30px;
            }
            .slider-content p {
                font-size: 18px;
                line-height: 26px;
            }
            /* New CSS */
            .swiper-slide {
              min-height: 370px; /* set according to your needs */
            }
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
        <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/js/swiper.min.js'></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<section class="custom-slider">
            <div class="container-fluid">
                <div class="row">
                    <div class="swiper-container">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                <!-- caption wrapper -->
                                    <div>
                                      <h1>What is Slide 01?</h1>
                                      <p>Lorem Ipsum is simply dummy text of the prin, remaining essentially unchanged. It was popularised in the 1960s with the release of</p>
                                      <p>Letraset sheets containing desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
                                    </div>
                                 <!-- caption wrapper ends -->   
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                  <!-- caption wrapper -->
                                    <div>
                                      <h1>What is Slide 02?</h1>
                                      <p>Lorem Ipsum is </p>
                                      <p>Letraset sheets including versions of Lorem Ipsum.</p>
                                    </div>
                                  <!-- caption wrapper ends -->  
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                            <div class="swiper-slide d-flex flex-wrap">
                                <div class="col-md-6 bg-very-dark-purple slider-content">
                                  <!-- caption wrapper -->
                                    <div>
                                      <h1>What is Slide 03?</h1>
                                      <p>Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
                                    </div>
                                   <!-- caption wrapper ends --> 
                                </div>
                                <div class="col-md-6 position-relative slider-image background-cover" style="background-image: url('http://placekitten.com/1000/500');background-size: cover;"></div>
                            </div>
                        </div>
                        <!-- Add Pagination -->
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </div>
        </section>

working 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

Learn how to utilize AngularJS Material to toggle the enable/disable functionality of a checkbox

Can someone assist me in enabling and disabling the checkbox as shown in the attachment image https://i.stack.imgur.com/l6g1C.jpg View the PLNKR angular.module('BlankApp', ['ngMaterial']) .config(['$mdThemingProvider', fun ...

"Troubleshooting: Why Won't insertAfter Function Work with

I have a p Element that I want to wrap inside a span tag. Then, I need to insert it after another p tag with the id output. Despite my attempts, the insertAfter function is not working as expected. $mytext = $("p#test").html(); $myspan = "<span styl ...

What is causing the discrepancy between the appearance of my fiddle and my page?

Hey there, I encountered an issue while working on a page using jsFiddle - it seems to be behaving differently when viewed on the actual website! If you want to take a look: http://jsfiddle.net/8Hpmj/8/ http://ktaadn.me/about/ The example at ktaadn.me do ...

A tutorial on utilizing fopen in PHP to write text lines to a .txt file

Struggling with PHP code utilizing fopen to write text lines into a textarea and save them to a .txt file. Below is the code I've been working on, hoping to get some assistance! <?php session_start(); if (!isset($_SESSION['username&ap ...

Designing a multi-platform web browser application for Android, iOS, and Windows 10

I've developed several web applications using HTML5 technology and now I'm interested in creating my own custom web browser specifically tailored for my apps/sites. I want it to have a native appearance, but essentially just wrap around my web ap ...

I prefer to have the links activate when the mouse hovers over them, rather than when hovering over empty

Is there a way to prevent the bottom links (music, contact, archive) from being highlighted when the mouse hovers over the empty space between them and not just on the actual links themselves? I want the mouse to only react to the links it hovers over and ...

Adjusting the repeating-linear-gradient CSS background

My goal is to make adjustments to a specific CSS code, in this case it is the repeating-linear-gradient. Take a look at my current implementation: input[type="range"]::-moz-range-track { background: repeating-linear-gradient(to right, #ccc, # ...

Running a shell script on a website should always be done in a single instance

When I use html/php to call a bash script on a website, I have multiple html-buttons that initiate the same script with different arguments. The issue arises when each button click opens a new instance of the script. Is there a way to somehow resume the r ...

Showing fetched data from Firebase in an Ionic 3 HTML file

Looking for assistance on how to display data retrieved from my firebase database in my HTML file. I need help with organizing the data, starting with displaying customer user's data. Eventually, I want to make it clickable and put the user's dat ...

The function "onClick" within an external .js file is being referenced

Just starting to learn Javascript and experimenting with an onClick event for an image in an external .js file using the HTML tag. <script type="text/javascript" src="embed.js"> The code found in "embed.js" is as follows: var image1=new Image(); i ...

The CSS3 Animation remains stationary

I've been attempting to animate my block element moving to the left using CSS animation shorthand property, but unfortunately, it's not working as expected. Here is my HTML: <div id="game"> <div id="block">&l ...

Applying specific style properties in styled-components can vary based on certain conditions

Is it possible to apply multiple properties at once? const Button = styled.div` color: blue; opacity: 0.6; background-color: #ccc; ` I want to apply styles for the active state without having to specify conditions for each property individually. Ho ...

Preventing PCs from accessing a specific webpage: A step-by-step guide

I am currently using the code below to block phones: if { /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i .test(navigator.userAgent)) { window.location = "www.zentriamc.com/teachers/error ...

View the Outcome of the Latest Form Submission on a Fresh Page

I have created a form that stores input values in a database table. Now, I want to display these results on another page once the form is submitted. However, I am struggling with how to retrieve and display all the values from the database record on the ne ...

jQuery Issue - Clash between multiple menus sharing the same class

Hey there! I'm currently diving into the world of jQuery and encountering an issue with my menu. Whenever I click on a menu item with either the "tm-nav-vertical" or "tm-nav-horizontal" class, it removes the .active class from the initial menu item. I ...

Adjusting color with the .on method in Event Listener

What's wrong with this code? html <!DOCTYPE html> <html> <head> <title>Ending Project</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> &l ...

Custom view with spannable text functionality

Can a custom view be included in a spannable text? I've noticed various types of spannable objects in the android.text.style package, but I'm curious if it's possible to insert a custom view. Something like spanable.setSpan(CustomView, .. ...

Guide to looping through a map arraylist in JavaScript

Here is a sample map arraylist. How can I access this arraylist using JavaScript from within pure HTML? And how can I iterate over this list? <%@page import="org.json.simple.JSONObject"%> <%@page import="org.json.simple.JSONArray"%> <% JSON ...

It is not possible to trigger an input click programmatically on iOS versions older than 12

Encountering a challenge in triggering the opening of a file dialogue on older iOS devices, particularly those running iOS 12. The approach involves utilizing the React-Dropzone package to establish a dropzone for files with an added functionality to tap ...

When scrolling, the fixed menu bar at the top of the page is making the content below jump

I am attempting to create a fixed submenu that sticks to the top of the page when scrolling, but I am encountering some issues. The current code I have is as follows: $(window).scroll(function () { if ($(window).scrollTop() > 175) { $('#loca ...