Try this:

  function filterInanimate(obj)
  {
    var newObject = {};
    var goodProps =
['width','height','left','right','top','bottom','margin','background'];
    for (prop in obj) {
      if ($.inArray(prop, goodProps) != -1) {
        newObject[prop] = obj[prop];
      }
    }
    return newObject;
  }


the goodProps array stores all the properties which you would like to be
able to animate.
Feed the object which you want filtering into the function to have the
filtered object returned:

var filteredObject = filterInanimate(myObject);



MisterV wrote:
> 
> 
> Hi,
> 
> I'm coding a jQuery plugin to draw modal windows. In this plugin, I
> make animations to show and hide the modal window.
> I'd like my plugin to be as much customizable as possible. So I want
> the animations to be customizable also. To do this, I have one option
> for the general css properties (the style of the window), one for css
> properties before "showing" animation, and one for css properties
> after "hidding" animation.
> 
> To make the "show" animation, I start by applying general style +
> before styles (before styles overwrites general styles). Than I get
> the difference between before styles and general styles,, and I use
> this object as the animation properties.
> 
> To make the "hide" animation, the general styles are already applied,
> I just launch an animation using the "after hiding styles" as the
> animation properties.
> 
> All this works very well, but I have just one small problem : All css
> properties can't be used as animation properties. And if I try to
> launch an animation with a "non-animable" css property, than the
> animation bugs.
> So I have to filter the properties I give to the animate function, to
> remove all "non-animable" properties. But to do this, I have to get a
> list of "animable" css properties.
> 
> Does someone knows how I can manage to get this list ? is there
> something like this in jQuery ?
> 
> Nico
> 
> 

-- 
View this message in context: 
http://www.nabble.com/animate-%3A-animable-properties-tp25297303s27240p25436295.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to