jquery.animate background-position doesn't work

前端 未结 5 1020
悲哀的现实
悲哀的现实 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:17

    jQuery doesn't support this on default.

    You can use a plug-in like : http://plugins.jquery.com/project/backgroundPosition-Effect

    EDIT:

    I was wrong, it works:

    $(function() {
      $('.moveme').css("backgroundPosition","0px 0px").animate({"backgroundPosition":"-100px 10px"});
    });
    

    It works if you type in the address bar, but it seems I can't make this work on jsfiddle, strange... xD

提交回复
热议问题