How to restore a view back to its original position via animation?

Hi there

I am using animate plugin of jquery
problem is I can apply animation on a view using animate() method

But When I click on Restore Animation state of an Object is not getting restore

this is I have tried so far

How can I acheive this?

You have a few problems in your code.

  1. All non-numeric-only values (strings) should be put in quotes.
    Wrong:

    width: 100px,
    border: 1px solid green,

Correct:

width: "100px",
border: "1px solid green",
  1. Those of CSS properties which consist of many words should be specified in lowerCamelCase notation.
    Wrong:

    background-color: #bca,
    (Javascript thinks you want to substract color from background here, because there is minus sign)

Correct:

backgroundColor: "#bca"

But even this form will not make background color animated. Documentation says:

All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color plugin is used)

That means you can remove that line completely.

width is not restoring after changing values in quotes

Width is restoring, but font size is not
That’s because you have a wrong case there:

fontsize:"10px",

should be:

fontSize:"10px",

And also replace “10px” with “100%” if you want to restore initial font size

Thanks megazoid

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.