Code: Select all
jQuery.animate({top: "+25px"});
Thanks for reading. All help is appreciate.
Cheers!
Moderator: General Moderators
Code: Select all
jQuery.animate({top: "+25px"});
Code: Select all
abcde.animate({top: parseInt(abcde.css('top')) + 25 + "px"});Code: Select all
elements.animate({top: "-25px"}); //Negative absolute or relative?
Code: Select all
elements.animate({top: "+-25px"}); //Negative relative to the current top value
elements.animate({top: "-25px"}); //Negative absolute
I see what issues you are saying it has. +-25 does seem confusing, but really what it means to say is add -25, which when you add a negative number it's the same as subtracting the equivalent positive number.kaszu wrote:I believe +-25px is confusing and shouldn't be part of the jQuery core, because '+-' is not a valid css value and this would add an exception.
If elements top value is '25em', then what '+30px' or '+30%' means?
Code: Select all
elements.animate({top: "+25"}); //add 25 px, em or % relative to the current value and depending on the value type(px, em, %, etc.).
elements.animate({top: "-25"}); //subjact 25 values relative to the current value and value type
elements.animate({top: "-25px"}); //set to absolute -25px
elements.animate({top: "+25em"}); //set to positive 25 em absolutely, same as 25em
Awesome pickle! += and -=... Now why didn't I think of that?pickle wrote:This is possible with jQuery. Read: http://docs.jquery.com/Effects/animate.