Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>background-position-x/y</code> is not really part of any CSS spec, its IE specific CSS, added to IE5.5, and later implemented by Webkit. </p> <p>Opera and Firefox do not accept it.</p> <p>The best solution is to use the <code>step</code> method, that will let you animate just about anything.</p> <p>To add a little to Luka's answer, which is somewhat wrong even though the method is correct, the easiest way to use the <code>step</code> method is to animate some arbitrary value, and hook a step to it, something like:</p> <pre><code>$('elem').animate({ 'border-spacing': -1000 }, { step: function(now, fx) { $(fx.elem).css("background-position", "0px "+now+"px"); }, duration: 5000 }); </code></pre> <p>The element will have to be wrapped jQuery style to accept jQuery methods, like <code>css()</code>. I've used <code>border-spacing</code>, but any css property that will not affect your site will work, just remember to set an initial value in your CSS for the css property used.</p> <p>The <code>step</code> method can also be used alone, if you set the fx.start and fx.end values, using it like Luka does with <code>now+=1</code> is pretty much equal to just using a setInterval instead, but the idea was sound all the same.</p> <p><a href="http://jsfiddle.net/q9aeh/1/" rel="nofollow noreferrer"><strong>FIDDLE</strong></a></p> <p><strong>EDIT:</strong></p> <p>with newer versions of jQuery there are other options as well, see this answer :</p> <p><a href="https://stackoverflow.com/questions/12340130/jquery-animate-background-image-on-y-axis/12340191#12340191">JQuery Animate Background Image on Y-axis</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload