Endless automatic pure CSS slider dock

I am on the hunt for a CSS-only infinite loop moving div. While I stumbled upon this codepen that almost fits the bill, I'm struggling to configure it so that the animation displays one logo at a time. Essentially, my goal is to initiate the animation, slide in one logo, pause for 5 seconds, and then introduce the next one.

https://codepen.io/jackoliver/pen/qVbQqW

HTML

            <div class="slider">
                <div class="slide-track">
                    <div class="slide">
                        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/557257/1.png" height="100" width="250" alt="" />
                    </div>
                    <div class="slide">
                        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/557257/2.png" height="100" width="250" alt="" />
                    </div>
                    <div class="slide">
                        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/557257/3.png" height="100" width="250" alt="" />
                    </div>
                    
                    (... Continues with more image tags ...)
                    
                </div>
            </div> 

CSS

            body {
                align-items: center;
                background: #E3E3E3;
                display: flex;
                height: 100vh;
                justify-content: center;
            }

            @mixin white-gradient {
                background: linear-gradient(to right,  rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
            }

            $animationSpeed: 40s;

            // Animation
            @keyframes scroll {
                0% { transform: translateX(0); }
                100% { transform: translateX(calc(-250px * 7))}
            }


            // Styling
            .slider {
                background: white;
                box-shadow: 0 10px 20px -5px rgba(0, 0, 0, .125);
                height: 100px;
                margin: auto;
                overflow:hidden;
                position: relative;
                width: 960px;

                &::before,
                &::after {
                    @include white-gradient;
                    content: "";
                    height: 100px;
                    position: absolute;
                    width: 200px;
                    z-index: 2;
                }

                (... Style rules continue ...)
    

If anyone has any insight on how to tackle this issue, please share your knowledge!

Many thanks!!

Answer №1

The snippet contains a comment where the code has been modified. Specifically, the size of a single slide has been increased.

For the code example, you can visit this link.

body {
align-items: center;
background: #E3E3E3;
display: flex;
height: 100vh;
justify-content: center;
}

@mixin white-gradient {
background: linear-gradient(to right,  rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
}

$animationSpeed: 40s;

// Animation
@keyframes scroll {
0% { transform: translateX(0); }
100% { transform: translateX(calc(-960px * 7))} // modifications made here
}


// Styling
.slider {
background: white;
box-shadow: 0 10px 20px -5px rgba(0, 0, 0, .125);
height: 100px;
margin: auto;
overflow:hidden;
position: relative;
width: 860px;

&::before,
&::after {
@include white-gradient;
content: "";
height: 100px;
position: absolute;
width: 200px;
z-index: 2;
}

&::after {
right: 0;
top: 0;
transform: rotateZ(180deg);
}

&::before {
left: 0;
top: 0;
}

.slide-track {
animation: scroll $animationSpeed linear infinite;
display: flex;
width: calc(960px * 14); //modifications made here
}

.slide {
height: 100px;
width: 960px; //modifications made here
}
}
<div class="slider">
<div class="slide-track">
<div class="slide">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/557257/1.png" height="100" width="250" alt="" />
</div>
... more image slides ...
</div>
</div>

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

Transmitting solely the updated information from the database

I am working on a table that is populated with data from the server using ajax. The table has columns A, B, C, and D where C and D are editable by the user. After the user makes changes to the data in the table, I need to capture only the lines that have b ...

The Node.js promise failure can be unpredictable, despite being properly managed

In my journey to master MongoDB, I am currently exploring its capabilities by building a basic blog application. However, I have encountered an issue with the code responsible for saving blog posts - it seems to be inconsistent in its success rate, sometim ...

Encounter a Config validation error while trying to utilize Nest.js ConfigService within e2e tests

I'm encountering an error despite having the NODE_ENV=development variable in my .env file. The error message reads: ● Test suite failed to run Config validation error: "NODE_ENV" must be one of [development, production] 11 | imports ...

How to flip the order of objects in ng-repeat using AngularJS

After uploading an excel file, my program reads it out in reverse order. However, I am facing a challenge with ng:repeat as it does not display the objects in reverse order within the Array of Objects. https://i.sstatic.net/WWCD1.png This is how the exce ...

Utilizing Vue Js and Query to retrieve data from a Jira Rest API endpoint

Trying to utilize the JIRA REST API within a Vue.js application has presented some challenges. After generating the API key, I successfully ran an API request using Postman. Initially, I attempted to use the axios client, but encountered issues with cross ...

Looking for assistance in setting up a personalized slideshow to automatically play on its

Recently, I have taken responsibility for a project that was initiated by someone else. The website contains a customized slideshow on its homepage. To meet the client's requirements, I have already made some alterations to the appearance and feel of ...

When attempting to POST data in Laravel, a status of 419 (unknown) is returned and the data cannot be posted to the target URL

I am attempting to create a DOM event that triggers when a user clicks on a table row's header (th) cell, deleting the corresponding row from the database that populates the table. Previously, my code worked as expected without any framework. I simpl ...

Here is a unique rewrite of the text: "Learn the process of toggling the tabindex for

Is there a way to dynamically change the tabindex of an element based on its visibility in the viewport? I am looking to either reset the current tabindex when entering a new section and assign new values to elements within that section, or disable and re- ...

What options exist for the format field in a font-face src declaration?

How can I determine when and how to use different font formats, and are they always necessary? Various websites provide examples like the ones below, with different arrangements: @font-face { font-family: 'Example'; src: url('Example.eo ...

Exploring the functionality of the JavaScript switch statement across various condition scenarios

switch (true) { case (angle<20): console.log("case1") break; case (angle<70): console.log("case2") break; case (angle< ...

Ways to launch the React Material date picker while hiding the date input field

I am working with the react material (MUI-X) date picker and my specific requirement is to have the date picker open on button click without displaying the date text field. I simply want to show the calendar and allow users to select a date. I have explore ...

Increase the height of a div dynamically in HTML during program execution

Within my datagrid, there exists an expandable/collapsible section above the content (see Picture 1 https://i.sstatic.net/N68Rl.png). Upon expanding the content, a scroll bar appears within the datagrid element to display the data (see Picture 2 https://i. ...

What is the best way to add scrolling to an absolutely positioned div that exceeds the viewport size?

Having an absolute positioned DIV with a defined height and width sometimes leads to it being cropped out when it doesn't fit the viewport's height. This can be frustrating, as shown in the images below: NORMAL VIEWPORT SMALL HEIGHT VIEWPORT I ...

What is the best way to retrieve an array of divs that have a particular class assigned to them?

Recently, I've been developing a web project that requires a gallery with a slider below it. To tackle this issue, I have utilized the following JavaScript code within a forEach(element) function: var divnumber = Array.from(element.parentNode.childre ...

Adding JQuery elements to the map pane

I recently decided to upgrade one of my projects to use the Google Maps API v3 instead of v2. In v2, I used the following code to append a div to the map pane: $("#marker_popup").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE)); Is there a straightforward ...

Customize the User Agent Stylesheet to improve text readability and accessibility

I am trying to make a simple, standalone page with menus that populate the text box (the one with "Left 1"). The text in the box is way to small on mobile and on desktop computers. https://i.sstatic.net/PX3tB.png I am trying to make this text b ...

Troubleshooting: CakePHP 3 beforeRender() function causing conflicts with global variables in JSON view

I'm facing an issue with my CakePHP 3.3.9 application. The problem arises when I try to send an ajax get request to the action, it simply doesn't work. I am utilizing a "prefix route" in this case. Despite going through numerous posts on handling ...

Why is my grid not showing the elements properly in ReactJS and CSS?

Currently, I am working with ReactJS, GridCSS in the Gatsby framework. I am attempting to create a subgrid within a subcomponent of the Gatsby layout.js file. However, after setting up my grid, the subcomponent fails to display the component correctly in i ...

Mapping out your data effectively requires following the correct steps to ensure accuracy and clarity

My goal is to display a map using Mapbox only once the data is ready. The Vuex store code I am working with is as follows: /store/index.js import Vue from "vue"; import Vuex from "vuex"; import _ from "lodash"; import { bac ...

Exploring the intricacies of backbone data modeling: mastering the art of data

Greetings everyone, I am delving into the world of Backbone and JavaScript. My data.json file is structured as follows: { "locations": [ {address:"2222", town:"Dallas"},{address:'3333', town:"Houston"},{}.... ], "items": [ {title:"shirt", ...