0

I have used scrolling script from this site. http://blog.waiyanlin.net/example/jquery/flyingtext.html. I need the animation scrolls from right to left. How can i do that?

designersvsoft
  • 1,861
  • 9
  • 39
  • 66

4 Answers4

0

find-replace your code, change Left with Right inside your document.ready() js

bondythegreat
  • 1,379
  • 11
  • 18
  • I have used image instead of the scrolling text. The width of the image is 900px. Now it is not sliding fine as the text slides. How can i correct that? – designersvsoft Dec 16 '11 at 04:56
0

If you have seen this animation is done by animating the left-margin of text from 0 to some pixals.

What you want to do is to animate it from right hence you can set marginRight, in the script, insteed of marginLeft.

UPDATE: In css you will also have to use

.flying-text
{
    //Remove this: margin-left:-100px;
    margin-right:0px;
}
Maheep
  • 5,539
  • 3
  • 28
  • 47
0

Replace marginLeft with marginRight and edit the CSS so the text is right aligned.

You can see a working example here: http://jsfiddle.net/DkRRw/

Luke Antins
  • 2,010
  • 1
  • 19
  • 15
  • If i used image which is 900px width instead of the text the sliding doesn't works fine. How can i correct that? – designersvsoft Dec 16 '11 at 05:31
  • 1
    I'm afraid that wasn't part of the original question. My feeling is you're very lazy and trying to get others to do all the leg work for you. Fire up Google and investigate CSS/Javascript, what you're trying to do isn't very difficult, even for a beginner. That way you'll actually learn something! – Luke Antins Dec 16 '11 at 05:38
  • I have been working for three days to correct this issue. But i couldn't correct that. – designersvsoft Dec 16 '11 at 05:53
0

As BondyThegreat pointed out, you need to swap Left with right in the script. You also need to make a change to the style sheet.

<script>
$(document).ready(function(){

    $('.container .flying-text').css({opacity:0});
    $('.container .active-text').animate({opacity:1, marginRight: "350px"}, 4000);

    var int = setInterval(changeText, 5000);    


function changeText(){

    var $activeText = $(".container .active-text"); 

    var $nextText = $activeText.next(); 
    if($activeText.next().length == 0) $nextText = $('.container .flying-text:first');

    $activeText.animate({opacity:0}, 1000);
    $activeText.animate({marginRight: "-100px"});

    $nextText.css({opacity: 0}).addClass('active-text').animate({opacity:1, marginRight: "350px"}, 4000, function(){

        $activeText.removeClass('active-text');                                           
    });
}
});
</script>

Update the style sheet to:

.flying-text{
   margin-right:-100px;
   text-align:right;
}
Brian Hoover
  • 7,861
  • 2
  • 28
  • 41
  • I have used image instead of the scrolling text. The width of the image is 900px. Now it is not sliding fine as the text slides. How can i correct that? – designersvsoft Dec 16 '11 at 05:24
  • 2
    @user1101208 - First you up vote all the posts that gave you a good answer to your problem, and select one to choose as the best answer. Secondly, you post a new question with an updated jsFiddle that shows the problem. Third, your problem gets solved. We are all working for points here. – Brian Hoover Dec 16 '11 at 05:28