Rotating text on a webpage in a circular motion

In my website design project, I am faced with the task of moving text from the left side of the screen to the right side. Initially, I used the <marquee> tag which worked smoothly without any errors.

However, my specific requirement is for the text to reappear on the left side as soon as it starts disappearing on the right side, rather than waiting for all the text to vanish before starting over. So far, I have only been able to achieve this using <html>. I would appreciate any suggestions for alternative methods to accomplish this.

Answer №1

One way to achieve this effect is by using Javascript:

To create a scrolling text animation, you can have two copies of the text positioned next to each other within a container. The left copy will be visible initially, then animate it offscreen to reveal the right copy. Once the animation completes, jump back to the original position and repeat the process.

Here's a basic example of how you can implement this with jQuery (please note that this code is untested):

<div class="outer">
  <div class="inner">
     some text
  </div>
</div>

CSS:

.outer, .inner {
  width: 100%;
}
.outer {
  position: relative;
  overflow: hidden;
}
.inner {
  position: absolute;
}

Javascript:

(function rerun(){
  var time = 10000 //ms

  $(".inner").slice(0,-1).remove()
  $i1=$(".inner")
  $i2=$i1.clone()

  $i1.css({left:0}).animate({left:"-100%"}, time)
  $i2.insertAfter($i1).css({left:"100%"}).animate({left:0}, time, rerun)
})()

This technique allows the text to continuously scroll from one side to the other smoothly. Adjusting the widths and timing can create different scrolling effects.

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

Include new options to the select box only if they are not already listed

I'm currently working on a situation where I need to transfer items from one select element to another, but only if they are not already in the second select: $('#srcSelect option:selected').appendTo('#dstSelect') My challenge is ...

What is the reason behind React re-rendering child components despite passing props that have been memoized with useMemo?

While exploring this topic, I stumbled upon an answer that seems relevant: When does React re-render child component? However, my inquiry delves into a more intricate question. Why does React typically re-render child components when utilizing the useMemo ...

Gap in footer spacing on Internet Explorer is significantly large

The layout of the page is split into two main sections: A large header that takes up 100% of the browser height The main content area and footer When viewing the page in a browser, only one of these sections will be visible. The following code works wel ...

A camera control stick in JavaScript

Looking to develop a camera control joystick that can move in four directions: left, right, up, and down with the ability to stop. After extensive research online, I stumbled upon something called nipplejs and attached the code below: var radius = 100; ...

Developing play and pause capabilities using JavaScript for the existing audio player

Currently, I am developing a Chrome extension that includes an HTML popup with buttons to play audio files. However, I feel that my current approach is not the most efficient and I am struggling to find ways to simplify the process. The method I am using n ...

Looking to add elements to a specific div dynamically using jQuery? Let's explore how to insert comments seamlessly

I would like to implement a comment system that adds entered comments to a specific div. Here's the code I have so far: <ul class="comments"> <li> <a class="commenter_name" href="/">Dushyanth Lion</a> ...

Updating the database table using javascript

I am looking to dynamically update my database based on a condition in JavaScript. Currently, I have been using the following approach: <a href="#" onclick="hello()">Update me</a> <script> function hello(smthing) { if(smthing == true) ...

Is there a way to blend together two elements within a Bigcommerce theme seamlessly?

Recently, I have been tasked with customizing a Bigcommerce theme for a client. While I am not very experienced with Bigcommerce and only have basic knowledge of php, I have encountered an interesting challenge with the current theme header setup. The exis ...

Error EPERM: Attempting to delete forbidden operation on 'C:Users** ode_modules.node-sass.DELETEvendorwin32-x64-57inding.node'

I encountered an error when trying to execute "npm install". OS: Windows 10 npm: 6.2.0 node: v10.9.0 Despite attempting to run "npm install" following the command "npm cache verify", the issue persists. npm cache verify npm instal Upon running th ...

What is the best way to send a selected value from a dropdown in a Jade template to a REST API in a Node.js application

I am working with a Jade template that includes two dropdown menus and a Load button. The goal is to send the selected values from these dropdowns to my Node API when the user clicks on the Load button. Here's the code I have been trying: extends lay ...

Designing stylesheets for larger screens to optimize the layout

I am currently working on the front-end design of a website and could use some assistance regarding element sizing. While the layout and elements look great on my 19-inch, 1440x900 resolution monitor, I noticed that everything appears tiny when viewed on a ...

Unusual conduct exhibited by jQuery's css() function for setting the width

My goal is to retrieve the width of the initial .imagen element and apply it to the img within .imagen. HTML: <div class="imagen"> <div class="normal"> <img> </div> <div class="hover"> <img> ...

Navigating with UI-Router within a single view for both viewing and editing purposes

I have been encountering an issue with changing states between the view page and edit page using UI-Router. Here are some of the things I have attempted: Controller: $stateProvider .state('showViewA', { views: { ...

Is it possible to apply a template file to all of my HTML pages for consistency?

I'm currently in the process of developing a website and looking for a template that I can use across all pages - including a news page, home page, about page, projects page, etc. I am aware that Dreamweaver offers this feature, but is there a way to ...

Trouble mapping an array of objects in ReactJS

I'm encountering an issue where I am unable to map through an array of objects in my component. Although I have used this map method before, it doesn't seem to be working now. Can anyone help me figure out what's going wrong? import React, ...

Ensure that Google Maps API in React always zooms in to the maximum level upon each

Working on implementing the Google Maps Api into my project by following the NPM bundle documentation at: https://www.npmjs.com/package/@react-google-maps/api While successfully calling my Google Map Component, I face an issue where upon every refresh, th ...

Issue with bootstrap accordion not collapsing other open tabs automatically

I'm struggling to incorporate a Bootstrap accordion collapse feature into my project, specifically with the auto-collapsing functionality. In the scenario where there are 3 divs labeled A, B, and C, if A is open and I click on B, A should automaticall ...

Showcasing an array of images on a Jupyter notebook layout

Looking for some assistance with displaying a dataframe in Jupyter notebook that contains 495 rows of URLs as a grid of images. Here is the first row of the dataframe: id latitude longitude owner title ...

Tips for universalizing the code of a file upload web form to accommodate various forms with distinct id attributes

Presently, I have a web form dedicated to uploading a single file using jquery. This elegant solution provides users with a progress bar and a message upon the successful completion of the upload process: <form id="uploadFileForm" method="post" action= ...

What methods can be used to retrieve text data from a website built with Angular technology?

Exploring new territories with Angular and Selenium, I find myself facing a challenge in extracting specific text fields from a website. The precise value seems elusive within the intricate web of HTML code. Seeking guidance or tips from experienced indivi ...