开发者

How to move an object continuosly using jQuery

I have a HTML page which has a title. I want to mov开发者_开发百科e the title horizontally using jQuery, until I close the browser. How can I do this?

Thanks..


I would use animate

DEMO

HTML

<div id="title">Title</div>

CSS

div
{
    position: absolute;
}

Javascript

anititle();

function anititle()
{
    $("#title").animate(
        {"right": "+=770px"}, 
        {duration:  5000,
        complete: function()
        {


    $("#title").animate(
        {"right": "-=770px"}, 
        {duration:  5000,
        complete: function()
        {
           anititle(); 
        }});

    }});
}

Source

Here #title is the ID of the html element holding your title text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜