Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving text circularly on web page [closed]

I am designing web page where I need to move text from left side of monitor screen to right side of screen. I have tried with <marquee> tag. It is working without any error.

My requirement is whenever text is about to disappear inside right side of web page it should start coming out from left side of page. It should not wait for all text to disappear and then start from left side.

Till now I have been doing it using <html> only. Please suggest other ways also.

like image 718
Prathamesh Avatar asked Oct 30 '12 15:10

Prathamesh


People also ask

How do I put text in a circle in HTML?

Create HTMLCreate a <div> with a class name "circle" inside the <body>. Place a number inside that <div>.

How do I make vertical scrolling text in HTML?

The <marquee> tag in HTML is used to create scrolling text or image in a webpages. It scrolls either from horizontally left to right or right to left, or vertically top to bottom or bottom to top.

How do you create an animated text in HTML?

CSS Code: In this section, CSS properties are used to create Text Animation. @keyframes are used which defines the code for animation. The animation is created by gradually changing from one set of CSS styles to another.


1 Answers

It is possible using Javascript:

Have two copies of the text being scrolled separated by the width of the container. Animate from (left copy visible) to (right copy visible), then jump back and repeat.

Something along the lines of (untested, using jQuery):

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

css:

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

js:

(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 way the text should start appearing on the right side as soon as it starts disappearing on the right side. Modify the relative widths to achieve a different effect.

like image 124
John Dvorak Avatar answered Sep 30 '22 23:09

John Dvorak