jquery.animate background-position doesn't work

前端 未结 5 1019
悲哀的现实
悲哀的现实 2020-12-03 18:43

I\'m trying to create a background position change with animation.
but for some reason it\'s not working.



        
5条回答
  •  醉梦人生
    2020-12-03 19:25

    Animating backgroundPosition does not work as of JQuery 1.5.0. You will have to revert to 1.4.4 if you want it to work. Apparently the fact that it worked in 1.4.4 at all is a coincidence, as "All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality. (For example, width, height, or left can be animated but background-color cannot be.)" Since backgroundPosition requires two numeric values, it should not be supported.

    See this bug ticket: http://bugs.jquery.com/ticket/8160

    And a possible solution: http://bugs.jquery.com/ticket/7755#comment:1

提交回复
热议问题