The scrolling speed of my news div is currently slow, and I am looking to increase its

This is the news div with bottom to top scrolling, but it is slow to start scrolling. I want to increase the speed. The current behavior is the div appears from the y-axis of the system, but I want it to start exactly where I define. The scrolling div is nested inside another div, but the animation starts at the bottom of the screen. It should actually start from inside the specific div.

.example1 {
  -moz-transform: translateY(10%);
  -webkit-transform: translateY(10%);
  transform: translateY(10%);
  -moz-animation: example1 2s linear infinite;
  -webkit-animation: example1 2s linear infinite;
  animation: example1 70s linear infinite;
}

@-moz-keyframes example1 {
  0% {
    -moz-transform: translateY(10%);
  }
  100% {
    -moz-transform: translateY(-10%);
  }
}

@-webkit-keyframes example1 {
  0% {
    -webkit-transform: translateY(10%);
  }
  100% {
    -webkit-transform: translateY(-10%);
  }
}

@keyframes example1 {
  0% {
    -moz-transform: translateY(10%);
    -webkit-transform: translateY(10%);
    transform: translateY(50%);
  }
  100% {
    -moz-transform: translateY(-10%);
    -webkit-transform: translateY(-10%);
    transform: translateY(-10%);
  }
}
<?php
$upcoming_news = $this->mastermodel->get_upcoming_news();
?>

<div class="example1" id="example1">
  <ul <?php if($this->lang->lang()=='ar') { ?> dir="RTL"
    <?php } ?>>
    <?php
       foreach ($upcoming_news as $row) {
          if ($this->lang->lang() == 'ar')
            $news = $row['news_description_ar'];
          else
            $news = $row['news_description_en'];
    ?>
    <li <?php if($this->lang->lang()=='ar') { ?> dir="RTL" style="text-align:right"
      <?php } ?>>
      <?= $news; ?> <br />
    </li>
    <?php } ?>

  </ul>
</div>

Answer №1

It seems like the duration of

animation: example1 70s linear infinite;
is quite lengthy. Maybe consider adjusting it to 2 seconds instead.

Check out this link: https://jsfiddle.net/3ce7309o/

Answer №2

Consider adjusting the value to

animation: example1 2s linear infinite;
in order to increase the speed of the animation. Your initial code was correct, but the duration of the animation may be too long.

Additionally, ensure that you have consistent values for -moz-animation: and -webkit-animation: as well.

.example1 {
  -moz-transform: translateY(10%);
  -webkit-transform: translateY(10%);
  transform: translateY(10%);
  /* Apply the animation to this element */
  -moz-animation: example1 2s linear infinite;
  -webkit-animation: example1 2s linear infinite;
  animation: example1 2s linear infinite;
}


/* Define the movement animation */

@-moz-keyframes example1 {
  0% {
    -moz-transform: translateY(10%);
  }
  100% {
    -moz-transform: translateY(-10%);
  }
}

@-webkit-keyframes example1 {
  0% {
    -webkit-transform: translateY(10%);
  }
  100% {
    -webkit-transform: translateY(-10%);
  }
}

@keyframes example1 {
  0% {
    -moz-transform: translateY(10%);
    /* Fix for Firefox */
    -webkit-transform: translateY(10%);
    /* Fix for Firefox */
    transform: translateY(50%);
  }
  100% {
    -moz-transform: translateY(-10%);
    /* Fix for Firefox */
    -webkit-transform: translateY(-10%);
    /* Fix for Firefox */
    transform: translateY(-10%);
  }
}
<div class="example1" id="example1">
  <ul>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
    <li>Phasellus in metus eget eros interdum convallis nec at felis.</li>
    <li>Vestibulum in metus nec augue interdum tincidunt.</li>
    <li>Aliquam mollis nibh ac lacus commodo, non placerat leo volutpat.</li>
    <li>Fusce a libero sed ligula suscipit lacinia.</li>
    <li>Morbi nec tellus in metus dignissim efficitur.</li>
  </ul>
</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

url-resettable form

Currently, I am working on an HTML form that includes selectable values. My goal is to have the page load a specific URL when a value is selected while also resetting the form back to its default state (highlighting the "selected" code). Individually, I c ...

Is styling in React not showing up?

Currently, I am tackling a third-party pagination component in Reactjs. The npm package instructs me to include the line import "rc-pagination/assets/index.css"; in the file. However, despite injecting the index.css into the DOM using the style loader, I ...

Placing information within a nested array with multiple levels of nesting

I'll try to keep this concise, Here is the structure of the schema... import mongoose from 'mongoose' const QuestionSchema = mongoose.Schema({ questionTitle: { type: String, required: " title"}, questionBody: { type: Stri ...

Personalized customizable elements in Draft.js (extension)

For instance, I am interested in enabling users to incorporate a dynamic slideshow of images into their page using Draft.js. This would allow them to select a predefined slideshow from my app and have it automatically update on their page if the images a ...

Exploring the dichotomy between controlled and uncontrolled elements within React. The _class attribute causing unexpected changes in an un

I created a custom Checkbox component that is essentially a styled checkbox with a 'fake element' acting as the original one. Custom Checkbox Component import React, {Component} from 'react'; import FormGroup from 'react-bootstra ...

Struggling to delete a table row using jquery

Currently, I am encountering an issue with removing a specific "tr" element within a table using jQuery. Here's the situation: I have a table where rows are clickable. Upon clicking on a row, I can update the data associated with that particular obj ...

What is the best method to extract text data from the Froala editor?

Currently, my method involves using $('div#edit').froalaEditor('html.get') to get the HTML data from the editor. Unfortunately, this process becomes problematic when trying to process or store the text data in my backend due to the pres ...

What sets the Test Deployment and Actual Deployment apart from each other?

I have been developing a web application using Google App Script and I currently have multiple versions of the same web app with various fields. Interestingly, when I run one version through a test deployment, it displays correctly as expected based on th ...

What impact do negative positioning have on CSS elements in terms of responsibility?

Just diving into CSS and I have a question to pose: Is it considered good practice to utilize negative positioning in CSS? Are there potential compatibility issues with browsers like IE7 and IE8? What is your suggestion? #example-bottom { position: relat ...

What is the best way to display time instead of angles in highcharts?

Hey there! I'm currently working with highcharts and I have a polar chart where I want to display time on the y-axis instead of angles. Here's what I've tried so far: On the x-axis, I have angles and I've set tickInterval: 45,. How can ...

Using environment variables in next.config.js allows for successful connection to the database, however, when attempting to use a

Utilizing the serverless-mysql library, I have successfully connected my next app to a remote MySQL DB through an SSH tunnel with the ssh2 library. Although everything is functioning properly, I am looking to enhance the security of my code by removing the ...

Can someone explain why line-height can affect the width in CSS?

Can you explain how the line-height property functions in CSS? I have noticed that when I set the line-height to be equal or less than the font size, it causes layout width issues. You can view an example of this problem on a jsFiddle here. Currently, my ...

Ways to align page title text at the center of the banner image without using flexbox or grid layout?

Seeking advice on how to vertically center the banner text in the middle of the banner image for a CSS-only psd conversion project. Any ideas on achieving this goal without utilizing flexbox or grid? header { background-image: url(../assets/main-ban ...

Troubleshooting: Why Isn't Jquery Hide/Show Function

I am currently working on enhancing my Jquery skills to toggle text visibility, but I am facing some issues. I am certain that it's something quite simple. Below is the HTML code I am working with: <script src="js/showhide.js"></script> ...

Is your YQL JSON script failing to provide the expected output?

Here is a script that I have copied almost directly from this. Why is it that the code below does not seem to return anything? ajax.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html dir="lt ...

The utilization of "startIcon" and "endIcon" from the <Button/> API of Material-UI is restricted

I've been trying to work with this React code for a single component, but no matter what I do, I keep getting the same warning. I even tried copying and pasting the example, but the warning persists and the icon is not showing up. Can someone please a ...

Troubleshooting Mobile App Errors with Rails API

My mobile application is connected to a Rails server. I am encountering an issue when attempting to edit an Item in the Rails database using a JSON request from my application. The first time I make the AJAX request, I receive an error message. {"readySta ...

Is there a way to align certain buttons to the left and others to the right within a DIV?

One of the strategies I experimented with was: <div class="block-footer"> <div> <button class="align-left">xx</button> <button class="align-right">yy</button> </div> </div> I'm ...

Jquery polling prevents HttpSession timeout from occurring

In our current setup, we are employing short polling using Jquery to regularly send ajax requests to the server in order to check for any updates. While the polling is functioning correctly, it is also keeping the session active at all times. This means th ...

I'm confused why this particular method within a class is not being inherited by the next class. Rather than seeing the expected extension, I am presented with - [Function (

Working fine with the Person class, the register() function displays the correct return statement when logged in the console. However, upon extending it to the Employee class, instead of the expected return statement, the console logs show [Function (anon ...