Having trouble positioning the Slick Carousel in the middle of the page

Having an issue with centering the Slick Carousel horizontally on my page, can you help?

HTML:

<!-- logo slider -->

<section id="customer-carousel" class="slider responsive container m-5">
  <div>
    <img src="/images/customers/eth_zuerich_logo.png" class="customer-slide">
  </div>
  <div class="text-center">
    <img src="/images/customers/kbsi_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/max-planck-institute-goettingen.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/nc_state_university_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/osaka_university_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/phoenixnmr_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/ruhr_universitaet_bochum_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/synex_medical_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/technical_university_of_brno_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/tu_ilmenau_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/tu_kaiserslautern_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/ucsb_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/UMD_logo.png" class="customer-slide">
  </div>
  <div>
    <img src="/images/customers/unh-logo.png" class="customer-slide">
  </div>
</section>


<!-- /logo slider -->

CSS:

#customer-carousel {
    width: 100%!important;
}

.customer-slide {
    width: 8rem;
    max-height: 10rem; 
    margin-left: auto;
    margin-right: auto;
}

JS:

(function ($) {
  'use strict';

  // Preloader js    
  $(window).on('load', function () {
    $('.preloader').fadeOut(100);
  });
  
  // Accordions
  $('.collapse').on('shown.bs.collapse', function () {
    $(this).parent().find('.ti-angle-right').removeClass('ti-angle-right').addClass('ti-angle-down');
  }).on('hidden.bs.collapse', function () {
    $(this).parent().find('.ti-angle-down').removeClass('ti-angle-down').addClass('ti-angle-right');
  });

  
    //slider
    $('.slider').slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        autoplay: true,
        dots: true,
        arrows: false
    });

})(jQuery);

The page is staged here & the carousel is right on the home page (customer logos):

Your assistance would be greatly appreciated!

Thank you!

Michael

Answer №1

The slider currently has a class "m-5" that is applying margins of 3rem!important, causing issues with horizontal centering. The fix involves removing this class. If the class is necessary, you can override the margins using CSS by targeting the ID:

#customer-carousel {
    margin-left: auto!important;
    margin-right: auto!important;
}

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

Dealing with blank values in jQuery DataTables

I am currently utilizing jQuery DataTable to display data in table format; within the table, there is a button that triggers a Bootstrap Modal for editing two of these values, and I utilize Ajax to send the modified values to a Spring Controller. The init ...

New approach: AngularJS - Using nested ng-click events

Looking for a solution to a problem with my html code: <div class="outerdiv" data-ng-click="resetText()"> <div class="innerdiv" data-ng-click="showText()"> {{ text }} </div> </div> The outer div has an ng-click fun ...

Constructing a regular expression

I've been exploring JavaScript regular expressions and encountering some challenges while trying to build a larger one. Therefore, I have decided to seek help for the entire problem rather than just individual questions. What I am looking for is a re ...

An easy way to activate the save button automatically

Is there a way to automatically enable the save button when a user checks the checkbox and enters text in the input field? I'm not sure what steps are needed or if there is an alternative approach to achieve this. jQuery("input[type='text&apos ...

Javascript continuously swaps out text from distinct strings in a loop

I wrote a loop to split a string and search for certain text to replace it with another string. Here is an example of what I have done: function replaceStr(str, find, replace) { for (var i = 0; i < find.length; i++) { str = str.replace(new RegE ...

Utilizing AJAX to retrieve data from a MySQL database upon clicking a button

Hello everyone, I am fairly new to the world of PHP and AJAX, so please bear with me. I am currently attempting to retrieve MySQL results using AJAX. I have made some progress thanks to the information I have gathered from various sources on the internet. ...

Is it possible to automatically close the modal by clicking outside of it

How can I make sure that my modal box only closes when clicking outside of it, and not when clicking on the buttons inside? I have a ref to the parent element that successfully closes the modal on click outside, but currently it also closes if I click on t ...

Perfect alignment in a vertical position can be hard to achieve down to

My goal is to perfectly vertically align the title inside the navigation panel. However, upon inspecting the screenshot images in an image viewer, I noticed a 1px gap at the bottom which makes the vertical alignment pixel-imperfect. https://i.sstatic. ...

Combining vueJS and webpack to bring in fonts, CSS styles, and node_modules into your project

I've recently started working with Vue.js and Webpack, and I'm facing some challenges regarding the correct way to import and reference fonts, CSS, and node_modules in my project. My project structure looks like this, as set up by vue-cli: buil ...

(IONIC) Issue with MomentJS locale functionality not functioning properly post-building process

I am currently utilizing the IONIC Framework and incorporating Moment.js for handling dates. I have set all strings to be in French using the code below: moment.locale('fr'); Interestingly, this works perfectly on the "serve" mode of Ionic. Ho ...

Creating a conditional statement in jQuery that will append text to a specific DIV element after a form has been successfully

I currently have a form set up that is functioning properly, but I am looking to make some changes. Instead of redirecting the user to a new page with a success message upon submitting the form, I want the success message to be displayed in a div next to t ...

Extract the ng-model name from the scope variable in Angular

Is there a way to accomplish this? ng-model="{{att.myModel}}" I have an array called AllSmallText which contains items. I want to create a form using ng-repeat on AllSmallText and set the ng-model value to be myModel, which is one of the item fields. ...

Encountering an Unresolved Runtime Issue: TypeError arises when attempting to access properties of undefined (specifically 'call') while utilizing the Image component in next.js

I'm currently experimenting with the Image component offered by next.js. This Is My Basic Header Component import Image from 'next/image' import React from 'react' import myImage from '../assets/IMG-20221115-WA0001.jpg' ...

Tips for incorporating a Forgot/Reset password option into your #Firebase platform

In the project I'm working on, I am utilizing #AngularFire2. My goal is to incorporate a Reset / Forgot password link into the login page. Does anyone have suggestions on how to accomplish this task? I'm looking to get some insights from #AskFi ...

In Typescript, it is not possible to assign the type 'any' to a string, but I am attempting to assign a value that is

I'm new to TypeScript and currently learning about how types function in this language. Additionally, I'm utilizing MaterialUI for this particular project. The issue I'm encountering involves attempting to assign an any value to a variable ...

Using Angular to swap out the component's selector with HTML code

Consider the following component: @Component({ selector: 'passport-cell', templateUrl: './passport-cell.component.html', styleUrls: ['./passport-cell.component.scss'] }) export class PassportCell { @Input() public la ...

Unable to Locate CSS File for MAVEN Web Project Using JSF

https://i.sstatic.net/I5vKT.png What is the correct way to reference it in XHTML? I have seen conflicting information online - some say the file should be placed as shown in the image above, while others mention needing to map resources in servlet-config. ...

Having trouble with Webpack dynamic import not returning files in ReactJS? Here's how to fix it

Struggling with importing and using images in Reactjs? I've imported all images from a folder but it's not returning an array with links. Take a look. function importAll(r) { return r.keys().map(r); } const images = importAll(requi ...

What is the process for using jQuery to systematically alter the src attribute of all avatar images on Twitter.com?

Summary: I am learning JavaScript and jQuery, and wanted to write a script to replace "_normal.png" with ".png" for all "img.avatar" images on Twitter.com. I encountered an error which I will explain below. Background: Practice makes perfect, so I like to ...

Managing nested Angular repeats with counter

In the previous section of my document, I have a presentation layer that effectively organizes information within a shopping cart. This arrangement functions perfectly fine. At the lower portion, I employ the following code to generate form variables whic ...