English 中文(简体)
j 低劣背景
原标题:jQuery backgroundPosition not accepting multiple values?

我试图在我身体上用变数作为坐标点来解释其背景形象,但似乎好像是 j,其背景只是一个价值。 我尝试了几件事,如背景经历:距离1+“+距离2”和背景:距离1+“-50px”(我想它在整个时间的价值),但即使我确定安保部的最高价值,也只是对两者都使用我的第一个价值(左)。 感谢任何帮助!

function shiftBoxes(distance1, distance2, id){
    activeBtn( pos  + id.substring(4));
    $("#boxMover").animate({
        marginLeft: distance1
    }, 500, function() {});
    $(document.body).animate({
        backgroundPosition: distance2
    }, 500, function() {});
}
//Add one of these for every box
//The distance to move to the next box is always -1804(*("#pos" + n) - 1) pixels
$("#pos1").click(function() {
    shiftBoxes( 0 ,  -1400 ,  #box1 );
});
$("#pos2").click(function() {
    shiftBoxes( -1804 ,  -1200 ,  #box2 );
});
$("#pos3").click(function() {
    shiftBoxes( -3608 ,  -1000 ,  #box3 );
});
问题回答

I found this example。 它希望你们需要围绕这样的价值观:

animate({backgroundPosition:” (-20px 94px)>}

2. 财产背景与价值如下:

top left bottom right center left

10%

xpos ypos, where You can use any cs unit as %, pixels, em等

and last

继承

用你的话说:

.style.backgroundPosition="center bottom";

或

.style.backgroundPosition = "20% 50%";

我希望这一帮助。 和平。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签