English 中文(简体)
横向发展背景评价
原标题:Horizontal scrolling background-image with jQuery

我在此试图 j:

$(document).ready(function(){
$( #bg ).animate({ backgroundPosition:  320px 0px }, 10000,  linear );
});

The CSS for bg:

#bg {
    background: url( scribbles.png ) repeat-x 320px 0px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

页: 1

<div id="bg"></div>

我希望背景形象能够慢慢地跨越屏幕。 任何建议?

感谢!

最佳回答

形象是否继续不断发展? 如果没有,以下可能是一个良好的起点:

$(#bg ).animate ({ backgroundPosition: +=100% 0px }, 10000, Linear );

如果要永远重复,则考虑以下解决办法,重新恢复呼吁:

var animateBackground = function()
{
    $( #bg ).animate
    (
        { 
            backgroundPosition:  -=100px 0px 
        }, 
        10000,
         linear ,
        function()
        {
            animateBackground(); // recursive call back
        }
    )
};

$( // short-hand for "$(document).ready"
    function()
    {
        animateBackground(); // initial call that starts everything off
    }
);
问题回答

这两种杂乱和杂草案的背景资料相同。 它们应当有所不同。 否则,它会走吗? 以前在 c和amp中设置一个职位;在法典的支部中给予最后地位。 工作!





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签