JimmyBanks JimmyBanks - 1 year ago 76
CSS Question

jQuery animate movement left and right

Using jquery's

i am changing the left attributes value to move a div left or right. Im looking for a way to animate this change as it occurs. Nothing ive tried is working, ive tried jQueryUI's
function, but this moves the whole div, rather than just the 120px movement i need.

This is my current function which is working without an animation:

var lm=$('.plwid').css("left");
lm = (parseInt(lm) + 120);
$('.plwid').css("left", lm);

this is the slide function, it does not work properly as the whole div goes from
, rather than just moving the pixel change

Answer Source

try animate()

    $('.plwid').animate({ left: '+=120' }, 400 );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download