MTK MTK - 8 months ago 24
jQuery Question

jquery add new property to css function

Is there some way to adding new property name to css in jquery ?
Something like transit which have a lot of new properties (duration,complete etc )
$o I need some like this:

var css_class ={
class1 : {height:100,background:'#000'},
//class2 ... etc
var my_property = function(value){

width: '100px',
my_property: 'class1'
//expected ... #element have width 100 also height and backround from class1
//I know it can be solved with a plugin like :
// .css(...).my_plpugin('my_property') but I dont want this

Thank you.

EDITED: Because more people answer what I try with this? I have added more details in the example.
Maybe mi example is not correct or can be solved in other way (no doubt) but the clearest question is: How the transit plugin (for example) have also other properties? (other than those of css) what is the mechanism (the way) to do this ?
Thank you.


finally I have added one condition of jquery source is not a professional solution but it work:

//I found this line in jquery source
//style: function( elem, name, value, extra ) {

//I added here mi condition
if(name[0] == '.'){
  var my_class_name = name.substr(1);

So now in mi js code i can write like this:

  width: '100px',
  '.class1': '', //the empty value for not throw errors 
  //... more css here ...
//now the #element have width 100px, height 100px and a black background