Swiper.IO pagination indicators not displaying

Why is the pagination not showing up on the image carousel I created with Swiper? Despite being in the DOM, it has a height of 0 and manual changes have no effect. Any suggestions?

import Swiper from '../../vendor/swiper.min.js';

export default {
  name: 'ImageCarouselBlock',
  components: {
    MediaImage,
  },
  props: {
    cmsData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  mounted() {
    let carouselConfig = {};
    if (this.cmsData.auto){
      carouselConfig = {
        spaceBetween: 30,
        centeredSlide: true,
        autoplay: {
          delay: 2000,
          disableOnInteraction: false,
        },
      };
    }
    else {
      carouselConfig = {
        spaceBetween: 30,
        loop: true,
        pagination: {
          el: '.swiper-pagination',
        },
      };
    }
    const mySwiper = new Swiper('.swiper-container', carouselConfig);
  },
  computed: {
    images() {
      return this.cmsData.images.map( image => {
        return {
          //  TODO maybe get something from amplicence that tells how big they want the carousel to be?
          imageData : getMediaAndSources(image.name, '1500'),
        };
      });
    },
  },
};

I've tried adjusting the position of the pagination element in the corresponding template but it hasn't resolved the issue. I'm stuck and could use some assistance.

<div class="image-carousel-block">
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide" v-for="image in images">
        <media-image preload="true" :sources="image.imageData.sources" :media="image.imageData.media" />
      </div>
    </div>
    <div class="swiper-pagination"></div>
  </div>
</div>

Answer №1

The issue originated in my Vue file.

<template src="./template.html"></template>
<script src="./script.js"></script>
<style lang="stylus" scoped> -- error found here
  @import '../../vendor/swiper.styl'
  @import './style.styl'
</style>

Simply removing the "scoped" attribute resolved the problem for me.

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

JavaScript code that opens a URL in a new tab with proper formatting

I'm having trouble figuring out how to make my JavaScript open a URL in a new tab. Here is the script: function viewSource(){ var webcache = "http://webcache.googleusercontent.com/search?q=cache:"; var request = "&prmd=ivn&strip=0& ...

Managing various iterations of identical repositories

Currently in the process of constructing a library of unique react components that are being utilized in various downstream applications. To incorporate these components into my downstream applications, I rely on the package.json. Recently, I began ponde ...

How can I monitor an input field that already has a value in Vue?

My current setup includes an email input and a watcher that verifies if the input is valid or not. The issue I'm facing is that the watch event only triggers when something new is typed into the email field. This means that if the existing value in th ...

The document.ready function does not seem to be functioning properly within an iframe

In the main page, there's an embedded iframe set up like this: <iframe src="facts.php" style="width:320px; height:500px; border:hidden" id="facts"> </iframe> Within that iframe, a jQuery function is implemented as follows: <script ty ...

The componentDidMount function is not initializing the state

I am trying to access the references from the render function and then set them to the state. Below is my code snippet: class App extends Component { constructor(props) { super(); this.arr = this.generateTimelineArray(); ...

Issue with monitoring property modifications in Vue.js

Issues with Component Variable and Prop Assignment Trying to assign a local component variable to a prop is causing Vue to throw an alert saying "Invalid watch handler specified by key 'undefined'". It's possible that the issue lies in pass ...

Error: Unable to retrieve the name property of an undefined object within a React component that is being used as a child component within another parent component

FundraiserScreen.js // Import necessary components and dependencies; // Import Fundraiser component; const Children = ({ loading, error, fundraiserData }) => { if (loading) // Show skeleton loading HTML if (!error) return <Fundraiser fundraiser={fund ...

Access Vuex Getters in a separate JavaScript file

Within the file /store/user/getters.js: function getLoggedIn (state) { return state.loggedIn } In a different file, router-auth.js, I attempted to access the value (true or false) of getters.getLoggedIn in the following manner: import user from '.. ...

jQuery UI Accordion - Adjusting Panel Height to Content Size

Currently, I am utilizing jQuery UI's Accordion feature from http://jqueryui.com/demos/accordion/, and my goal is to adjust it so that it resizes based on the contents of each panel rather than just fitting the largest one. In addition, I am seeking ...

JavaScript and AJAX are showing an error message that says: "ReferenceError: x is not

I am currently working on a jQuery function that retrieves the value from a PHP-generated checkbox and sends it through AJAX. The value being sent is always a single word consisting only of letters. Here is the script I have written: <script type="text ...

Retrieve the toggle input value to change the page view using jQuery

I'm currently working on a web photo gallery project and I am looking to incorporate a toggle input button that allows users to switch between displaying albums or all photos. To achieve this, I need to extract the value of the input using jQuery and ...

Using JQuery to compare duplicate values within the same input name

I am dealing with several hidden input fields like the ones below: <input type="hidden" value="4531" name="product_id"> <input type="hidden" value="4532" name="product_id"> <input type="hidden" value="4533" name="product_id"> My goal is ...

JQuery Tic Tac Toe Duel: Face Off Against Your Friend in a Thr

Looking for some advice here. I'm new to game development and currently working on a 2 Player Tic Tac Toe game. I need help with implementing the game functionality. Any suggestions? I want to disable the "div" once a player clicks on it, but I' ...

Tips for effectively wrapping Material UI v5 component to ensure the Grow component functions correctly

Being a newcomer to React, I want to apologize in advance for any silly mistakes or inaccuracies that may be present. I have successfully implemented the code for my Blog page: export default function Blog() { const [photos, setPhotos] = useState([]); ...

Using Asynchronous JavaScript and XML (AJAX) to make calls to a web service

My program is showing an internal server error var parameters = "<?xml version='1.0' encoding='utf-8'?>" + "<soap:envelope xmlns:xsi='ttp://www.w3.org/2001/xmlschema-instance' xmlns:xsd='http://www.w3. ...

Accessing the Div id stored in a session parameter

Is there a way to store the id (div id) into a session variable? This is an example of my code below: <div class='fieldRow'>Options </div> <div id="abcde"></div> <div class='Row'> <?php $user_typ ...

Implementing dynamic content updating in WordPress by passing variables and utilizing AJAX

Currently, I am working on a shopping page that displays a list of all the stores. To streamline the user experience, I have created a sidebar containing various categories and implemented pagination within the store listings. These lists are generated thr ...

Press a button to link a click event handler to another button

function example() {console.log('example');} $('#button1').click(function(){ $('#button2').onclick = example(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> ...

Execute a function prior to making a synchronous call

Seeking guidance on a complex issue that I have encountered. In my code, I am dealing with a synchronous AJAX call and need to execute a function before this particular call is made. The function in question is a simple one: $.blockUI(); This function ...

Can you explain the role of the next() function in middleware/routes following the app.use(express.static(...)) in Express

When dealing with serving static assets generated from React source code using npm run build, the following method can be used: app.use('/', express.static(path.join(__dirname, 'apps', 'home', 'build'))) To protect ...