Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is the jQuery backgroundPosition animate function jumping instead of animating?
    text
    copied!<p>I'm trying to create 3 buttons (image is a background image) that animate smoothly when doing a mouseover.</p> <p>When I'm using the following html, css and js, the result is a jquery animation where the animation just jumps to the result in stead of creating a smooth animation towards the result.</p> <p>See the result at: <a href="http://infinitize.com" rel="nofollow noreferrer">http://infinitize.com</a>, currently only the first button is animated.</p> <p>CSS:</p> <pre><code>/*-- HOMEPAGE --*/ #buttons {margin-top:60px;} #buttons a {display:inline-block;width:160px;border-bottom:none;color:#4b4f52;text-shadow:0 1px 0 #fff;font-size:20px;padding-top:180px;text-align:center;} .bg-img-home {background:transparent url(&lt;r:assets:url title="bg-img-home" /&gt;) no-repeat;} #webdesign {background-position:0px 0px;} </code></pre> <p>HTML:</p> <pre><code>&lt;div id="buttons" class="span-24 last"&gt; &lt;div class="span-3"&gt;&amp;nbsp;&lt;/div&gt; &lt;div id="webdesign" class="span-5 bg-img-home"&gt;&lt;a href="#" id="jump-webdesign"&gt;WebDesign&lt;br /&gt;Web Development&lt;/a&gt;&lt;/div&gt; &lt;div class="span-2"&gt;&amp;nbsp;&lt;/div&gt; &lt;div id="ecommerce" class="span-5 bg-img-home"&gt;&lt;a href="#" id="jump-ecommerce"&gt;E-Commerce Solutions&lt;/a&gt;&lt;/div&gt; &lt;div class="span-2"&gt;&amp;nbsp;&lt;/div&gt; &lt;div id="openbravo" class="span-5 bg-img-home"&gt;&lt;a href="#" id="jump-openbravo"&gt;OpenBravo&lt;br /&gt;ERP/POS solutions&lt;/a&gt;&lt;/div&gt; &lt;div class="span-2 last"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Script:</p> <pre><code>$(document).ready(function(){ $("#jump-webdesign").hover(function(){ $("#webdesign") .animate({backgroundPosition: '0px -10px'},200).animate({backgroundPosition:'0px 0px'},200) }); }); </code></pre>
 

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