My jQuery animate won't reposition -
i trying reposition button whenever clicked, can't damn thing move... can rescale it, won't move...
my code looks this:
$('#test').on('click', function() { $(this).animate({ left: '100px', }, 1000); });
you'll need set position
either relative
, absolute
, fixed
or sticky
.
position: static
default instructs browser ignore top
/right
/bottom
/left
properties.
class="snippet-code-js lang-js prettyprint-override">$('#test').on('click', function() { $(this).animate({left: '100px'}, 1000); });
class="snippet-code-css lang-css prettyprint-override">#test { position: absolute; top: 0; left: 0; }
class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div id="test">click me!</div>
jquery jquery-animate
No comments:
Post a Comment