What is the best way to create a never-ending horizontal animation that moves a logo image from right

I have a dilemma with displaying my logo images. I have more than 10 logos, but I want to showcase only 6 of them on page load. The rest of the logos should slide horizontally from right to left in an infinite loop.

Can anyone assist me with creating keyframes and CSS for this effect?

I came across an example at https://codepen.io/mdashikar/pen/VWPvgE but it's not exactly what I need. In that example, the image slides from right to left, pauses for a few seconds, and then repeats. However, I require the image to slide continuously without interruption.

.logo_slider {}
.logo_slider ul { 
  margin: 0;
  padding: 0;
  list-style: none;
}

.logo_slider ul li {
  display: inline-block;
  border: 1px solid #ccc;
  margin: 20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.logo_slider ul li a img {
  width: 100%;
  -webkit-animation: mymove 5s infinite; /* Safari 4.0 - 8.0 */
  animation: mymove 5s infinite;
}

/* Safari 4.0 - 8.0 */
@-webkit-keyframes mymove {
  from { right: 0px;  }
  to   { left: 200px; }
}

/* Standard syntax */
@keyframes mymove {
  from { right:0px;   }
  to   { left: 200px; }
}
<div class="logo_slider">
  <ul>
    <li><a href=""><img src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Android_O_Preview_Logo.png"></a></li>
    <li><a href=""><img src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Android_O_Preview_Logo.png"></a></li>
    <li><a href=""><img src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Android_O_Preview_Logo.png"></a></li>
    <li><a href=""><img src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Android_O_Preview_Logo.png"></a></li>
  </ul>
</div>

Answer №1

Does this meet your requirements?

.logo_slider {
  overflow: hidden;
}

.logo_slider ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.logo_slider ul li {
  display: inline-block;
  border: 1px solid #ccc;
  margin: 20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.logo_slider ul li a img {
  position: relative;
  width: 100%;
  position: relative;
}

.logo_slider ul li:nth-child(1n+7) a img {
  -webkit-animation: mymove 5s infinite;
  /* Safari 4.0 - 8.0 */
  animation: mymove 5s infinite;
}


/* Safari 4.0 - 8.0 */

@-webkit-keyframes mymove {
  from {
    left: 100vw;
  }
  to {
    left: 0;
  }
}


/* Standard syntax */

@keyframes mymove {
  from {
    left: 100vw;
  }
  to {
    left: 0;
  }
}

You can also view my codepen here: https://codepen.io/zothynine/pen/VQyzQZ

Answer №2

Give this a try, it should do the trick

// Accessing variables
let topScroll = $(document).scrollTop();
let windowHeight = $(window).height();
let bodyHeight = $(document).height() - windowHeight;
let scrollPercentage = (topScroll / bodyHeight);

// Load more content if scroll is over 90% from the top.
if(scrollPercentage > 0.9) {
    // Additional content loading logic goes 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

What is the best way to create a more effective xpath expression?

My HTML code resembles the following: <tr> <td> <span> <span class = "x28w"></span> </span> <td> <span> <a> <span>3899393</span> </a> < ...

The hover functionality fails to activate when a z-index is applied

My issue revolves around 2 divs: one containing a link and the other a box-shaped container. The link is set with position:fixed; causing it to fly over the container div. To resolve this, I attempted to assign a negative z-index value to the link, but unf ...

Seamless transition of lightbox fading in and out

Looking to create a smooth fade in and out effect for my lightbox using CSS and a bit of JavaScript. I've managed to achieve the fading in part, but now I'm wondering how to make it fade out as well. Here is the CSS code: @-webkit-keyframes Fad ...

How to Conceal the <th> Tag with JavaScript

I attempted to conceal certain table elements using JavaScript. For <td> elements, it works fine: function hide(){ var x=document.getElementsByTagName('td'); for(var i in x){ x[i].style.visibility='hidden'; ...

Tips for centering a paragraph vertically within a div element

I'm struggling to achieve automatic vertical alignment for this. While I can manually center it using padding-bottom, I prefer a way to position it vertically on its own. How can I accomplish this while retaining the display: inline-block feature? &l ...

The variable is remaining stagnant

So I wrote this script. Inside the createApp function, there's a variant variable. I'm logging the content with console.log(variant) after axios.get(). It should change to results.data.variants[0], but it's not working... need suggestions? ...

Unusual div image alignment when dimensions are dynamically adjusted with Javascript animations

I have created a basic webpage using JavaScript that aims to scale an element from the center of the page over time when clicked. It is functioning properly for the SVG element I tested it with. However, when I use an image, it initially appears outside o ...

How can I temporarily change an image when clicking on it using JavaScript?

I am working on an image section where I want to change the image for a few seconds when clicked and then revert back to the original image. Here is the code I have tried: <img src="contacticons.jpg" usemap="#image-map" id="imgName"> <a onclick ...

Tips for showcasing a lineup horizontally with HTML and CSS

I'm currently working on creating a menu using HTML. I've included my links in an unordered list (ul) as shown below. In my CSS, I added a display:inline; property to the links to make them appear side by side like a menu. However, for some reaso ...

Is there a way to display "not found" if the code's output is blank?

Incorporating an "ajax select" and "while scrolling load data" script has been successful for me. However, I'm struggling with displaying a "not found data" message in div.status when the output variable on animals.php is empty. index.html <!DOCT ...

Issue with HighCharts Series Data Points Not Being Added

I am currently facing a major challenge in dynamically changing data for highcharts based on date. To provide context for my project, it involves logging system data with timestamps. I have implemented a date and time picker to specify the start and end da ...

Leveraging JavaScript Fetch() and formData() for Database Updates

As I delve into my JavaScript project, utilizing the fetch() method, I find myself facing a puzzling situation. Despite having a grasp on the basics of fetch and formData, the code in question appears needlessly complex for its intended purpose, leaving me ...

Solving relative paths in NodeJS/Express

My website is calling several scripts, images, styles, etc., from different folders both inside and outside the main folder: File Tree - / - website - scripts - data.js - customJquery.js - styles ...

What is the best way to dynamically update HTML Select elements using Ajax when other Select elements change?

Currently, I have a search page featuring 7 select dropdowns and 2 textfields. The options in the selects are pulled from a MySQL database. I am looking to implement a functionality where when I make a selection in one of the dropdowns, the other selects ...

Incorporate a button within a listview on Kendoui to trigger the opening of a modal window

I am seeking assistance on how to insert a button on each element of a Listview (PHP/Json) result. When clicked, this button should open a modal window where the customer can input reservation details such as Date, Adults, and Children. Below is the JavaSc ...

Adjust the background of the input range style prior to the thumb icon

Is there a way to style the bar before the thumb with a different color on a range input? I have been searching for a solution without much success. This is the desired look: Unfortunately, Chrome no longer supports input[type='range']::-webkit- ...

When a child SPAN surpasses the height of the parent TD/TABLE, trim it down

I am attempting to make my outer table/td clip the inner SPAN when the content of the span exceeds the height of the outer table, all while maintaining vertical and center alignment. Instead of the current layout: https://i.sstatic.net/s33q7.png I want ...

Ways to display JSON result array without using JavaScript code

I am working on a script that consults an external API to retrieve specific data. My goal is to display only the array result without any visible JS or HTML code. I believe this is achievable, but unfortunately, I am unsure of how to implement it. As some ...

Error encountered when transitioning to TypeScript: Unable to resolve '@/styles/globals.css'

While experimenting with the boilerplate template, I encountered an unusual issue when attempting to use TypeScript with the default NextJS configuration. The problem arose when changing the file extension from .js to .tsx / .tsx. Various versions of NextJ ...

AngularJS Error Present in Chrome Only

While this code works perfectly in Firefox and IE, it encounters an issue in Chrome. An error occurs at the ".find" line which results in a "TypeError: undefined is not a function". angular.forEach(data, function(data) { pointInfoFactory.ge ...