Utilizing a smooth carousel with an equal number of slides for display

I have a slick slider set to Center Mode with an even number of slidesToShow. The goal is to have the active slides at full opacity (1) and inactive slides at half opacity (0.5). However, due to the even number of slides, the implementation is not working correctly. Slick.js automatically applies a 'slick-active' class, but it is causing issues in this scenario. https://i.sstatic.net/7aroL.jpg

In the image, you can see that the first half of the inactive slides on the left are at half opacity. I want the same effect for the 5th slide, which has the 'slide-active' class. Unfortunately, the nth-child and last-child selectors do not seem to be functioning as expected.

Any suggestions for a workaround?

Answer №1

Experiment with adjusting the opacity of the slick-slide class by reducing it and then restoring full opacity to active slides.

  $('.accom-slider').slick({
    centerMode: true,
   slidesToShow: 3
   });

Answer №2

Here's a solution I created for my own needs, hoping it might be useful to you: http://example.com/slick-slider-centered/


$('.center').slick({
  speed: 500,
  arrows: false,
  centerMode: true,
  centerPadding: '0px',
  slidesToShow: 3
});

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

Guide on aligning a series of divs in a single row within a parent div

Within the confines of a 400px wide div called "container", there are six left-floated "box" divs, each 100px wide. The combined width of the "box" divs exceeds 400px, resulting in the divs wrapping onto two lines, with 4 on the first and 2 on the second ...

Testing AngularJS directives with external templates for unit testing

I have been utilizing the npm package karma-ng-html2js-preprocessor to achieve this task. This is the content of my spec file: describe('Directive: aGreatEye (external)', function() { var elm, scope; beforeEach(module('my-thing.te ...

Expansive width of form field

I have a yellow top bar that is fixed in position and spans 100% of the width. Inside this bar, there is a red div with fluid width on the left and a green div containing an input element on the right. The input element needs to take up the remaining spa ...

Error message: It seems the spatial reference for this ESRI object is missing

Currently, I am utilizing Esri GIS to load the center location from an address. However, I am encountering an issue as I am using a geocoder from Google to obtain longitude and latitude, which is resulting in the following error message: TypeError: this.s ...

problems encountered when including next.config.js for sitemap creation in a nextjs application

Just recently, I made an update to my next.config.json file in hopes of boosting SEO performance. However, this change has caused some issues with the next-sitemap module, preventing me from building or starting my app. //next.config.js const withSitemap = ...

Display an "add to cart" button and a discount image when hovering over

Currently, I am in the process of developing an Online Shopping website using PHP. To enhance the design of my website, I have implemented bootstrap. One specific query I have is how to display an 'add to cart' button and a discount image when a ...

Storing deeply nested arrays of objects with Mongoose leads to MongoDB storing empty objects

Here's the issue I'm facing: I am trying to save nested objects with mongoose in mongodb, but when I save them, the nested objects end up empty. I have attempted various solutions found online, such as pushing objects and populating, but none o ...

I am trying to access a value saved in a service in Angular 8 component and use it in other services. Can anyone help

Setting a value through a component export class UniqueComponent { constructor(service:UniqueService){ } count =0 ; onRefresh(){ this.service.count = 1; } } Using the value in the service UniqueService{ count:any; doSomething(){ //using count ...

"Seamlessly integrating Fabric Crashlytics into your Angular-powered web application

Currently, I have integrated Fabric/Crashlytics into my mobile application. I am now interested in connecting an angular webapp to Fabric/Crashlytics. Is this a feasible option, and if so, what is the process to achieve this integration? ...

Creating an Angular form from scratch using HTML

I've developed a component named login. Initially, I created an HTML form called login.component.html and then decided to convert it into an Angular form. To achieve this, I inserted <form #loginform="ngForm"> in the login.component.ht ...

"Implementing a function in React to update the state based on target name and value received from

In an attempt to update the state, the current function (handleLabelChange) technically works by updating the state. However, I am looking to dynamically add a name instead of textOne and a value of "????" from the textarea field or another input field. It ...

Using Jquery to extract data from an array stored in a textarea

Is there a way for me to paste the following code snippet inside a textarea and then access it as a common variable in my script? var cars = new Array(new Array(3), new Array(3)); cars[0][0] = 'FORD'; cars[0][1] = 'Focus'; cars[0][2] = ...

javascript - Include new parameter in object literal and retrieve

I have a base object that I define using an object literal: var obj = { key1 : 'value1', key2 : 'value2' } Now, I want to pass this object to a function and extend it like this: myFunction( obj + { key3 : 'value3' ...

Is it possible to activate the identical drop-down or popover with multiple buttons?

Is it possible to activate the same drop-down menu with multiple buttons? For example, I want a button at the top of the page labeled special menu, another in the middle also labeled special menu, and one at the bottom as well labeled special menu. When a ...

A HTML table featuring a stationary header, a scrollbar for horizontal navigation, and columns that adjust in

For the past week, I've been attempting to create an HTML table with a fixed header, dynamic column widths, and horizontal scroll. I've come across several options, but each seems to be lacking in some way. I would greatly appreciate any assista ...

Creating an SQL select statement with a three-level expression is a complex task that requires careful planning and

How can I create a SQL select query with 3 levels of expressions and statements? Typically, my website operates on an SQLite database and the search results are displayed using the following SQL query: "SELECT DISTINCT * FROM amz WHERE Title LIKE \" ...

Safari Version 8.0.2 experiencing issues with fixed positioning

I am currently working on an angular application and I find myself inside a Twitter Bootstrap modal. My goal is to relocate a button that is located within the body of the modal to the footer of the modal using fixed positioning. This particular button tr ...

The line break refuses to concatenate

I've been grappling with trying to format and print a 9x9 2D JavaScript array into a grid, but for some reason I can't seem to get the line breaks right. Instead of displaying the array in a neat square grid, it's all coming out in a single ...

develop a real-time website availability tracker using Node.js

I am interested in developing an uptime monitor using NodeJS and MongoDB. The plan is to set up a cron job in NodeJS that will collect data and store it in MongoDB. Specifically, if the response status code of a website is not equal to 200, then that infor ...

Bootstrap: Organize Columns Simultaneously with Push and Pull for Customized Column Ordering

I am experiencing an issue with the concurrent use of "Push" and "Pull" column ordering classes. I would like my columns to be ordered like this: However, the result on medium and larger screen sizes is <section style="direction:rtl;"> <div cla ...