English 中文(简体)
Jquery - 动动背景问题
原标题:Jquery - animate background issue
  • 时间:2012-05-24 05:44:33
  •  标签:
  • jquery

我搜索了网络上的背景动画样本。

http://jsfididle.net/rwaldron/TzWQA/

并且它的工作原理是外观和铬, 但是动画背景与歌剧和Firefox不合作。 是否有任何办法可以让浏览器之间进行这项工作?

它包含的代码是:

$(document).ready(function(){
 $("#puppies")
    .animate({
        backgroundPositionY: "0px",
        backgroundPositionX: "-250px"
    }, 2000);
});
最佳回答

FF 不支持 < 强度 > 地表位置 < 强度 > < /强度 > 和 < 强度 > 地表位置X < /强度 > 。 因此,如果您想要动画背景, 您应该通过 < 强度 > X, Y < /强度 > 的数值, 组合到 < 强度 > 地表位置 < /强度 > 。

以下是对同一问题的讨论:

form-image 动画在 Firefox 中不起作用

另见:

http://www.protofunc.com/scriptions/jquery/backgroundPostion/"rel="没有跟随 noreferrer" >http://www.protofunc.com/statics/jquery/backgroundPosimtion/

http://snook.ca/archives/javascription/jquery-bg-image-animations/"rel=“不跟随 no follown noreferrer" >http://snook.ca/archives/javascript/jquery-bg-image-animations/

希望这能帮上忙

问题回答

@AlphaMale 描述为什么您的代码失败是准确的。 我使用一个手动的片段, 使此工作以下列语法交叉浏览器 :

$(document).ready(function(){
  $("#puppies")
    .animate({
        backgroundPosition : "(0 -250px)"
    }, 2000);
});

See it in ACTION! http://jsfiddle.net/dUmNN/1/





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

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.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签