Dec
17

With this great javascript framework, jQuery, you can create some flash like effects. In this post, I will show how to create very simple flying and fading text effect using jQuery. Here is live demo.


javascript:

$(’.container .flying-text’).css({opacity:0}); //set all text opacity to 0
$(’.container .active-text’).animate({opacity:1, marginLeft: “350px”}, 4000); //animate first text

var int = setInterval(changeText, 5000); // call changeText function every 5 seconds

function changeText(){

var $activeText = $(”.container .active-text”); //get current text

var $nextText = $activeText.next();  //get next text
if($activeText.next().length == 0) $nextText = $(’.container .flying-text:first’); //if it is last text, loop back to first text

$activeText.animate({opacity:0}, 1000); //set opacity 0 to animated text
$activeText.animate({marginLeft: “-100px”}); //set animated text position to default

//animate next text
$nextText.css({opacity: 0}).addClass(’active-text’).animate({opacity:1, marginLeft: “350px”}, 4000, function(){

$activeText.removeClass(’active-text’);
});
}

HTML:

<div class=”container”>
<h3 class=”flying-text active-text”>I believe</h3>
<h3 class=”flying-text”>I can</h3>
<h3 class=”flying-text”>Fly</h3>
</div>

CSS:

body{
background-color:#000;
}

.container{
background-color:#000;
width:500px;
margin:0 auto;
color:#FFF;
overflow:hidden;
}

.flying-text{
margin-left:-100px;
}

Check this live demo.

Related Posts

  • No Related Post

10 Comments

  1. Htoo Tay Zar
    December 20, 2008 @ 9:36 pm

    Thanks for this tut. I’ve learn a lot from this.

  2. waiyan
    December 22, 2008 @ 11:35 am

    Glad to hear that. :)

  3. kha
    February 9, 2009 @ 9:38 pm

    Nice tuts. ^_^ pleasure to meet u r blog.

  4. Zay yar
    February 11, 2009 @ 1:05 pm

    Nice!

  5. waiyan
    February 11, 2009 @ 5:08 pm

    Thanks! :)

  6. Dov
    November 8, 2009 @ 4:41 pm

    First of all thank you for great tutorial.
    I would like to know, why the text is not smooth ?
    i mean: if you use clear background and green text you can see black pixels around the text.

  7. Pingback 20+ Easy to Use jQuery Text Effects and Animations : Speckyboy Design Magazine
    November 17, 2009 @ 12:07 am

    [...] jQuery: Flying Text With Fade Effect [...]

  8. Pingback 20 Einfache JQuery Text Effekte
    November 21, 2009 @ 10:21 pm

    [...] jQuery: Flying Text With Fade Effect [...]

  9. saduran
    November 23, 2009 @ 10:55 pm

    firstly tnx for this good tutorial , how can i extend width of the text i mean i want text will going from left to right along page ? tnx

  10. Pingback Jquery ile metinlerinize efekt verin | Blog GizliKale Güncel Linkler
    December 1, 2009 @ 3:52 pm

    [...] jquery- flying text with fade efekt: demo ve download metinlerinzi kaydırmaya yarayan bir eklentidir. metinler solarak [...]

RSS feed for comments on this post. TrackBack URL

Leave a comment

recent comments