CSS宣言をjQueryで
ふと思いついて書いてみた。
どうでしょこれ?
コード量減るし見やすいしコメントアウトしやすいし
tables ={
'1px solid #333':{
'border-top':'table',
'border-left':'table',
'border-right':'td,th',
'border-bottom':'td,th'
},
'collapse':{
'border-collapse':'table'
}
}
for(var i in tables){
for(var j in tables[i]){
$(tables[i][j]).css(j,i);
}
}
items = {
'background':{
'body':'#000',
'th':'#ccc',
'.individual':'#ccf',
'.company':'#cfc',
'.special':'#ff9',
'.active':'#fff'
},
'width':{
'table':'100%'
},
'height':{
'table':'100%'
},
'font-size':{
'td,th':'11px'
},
'padding':{
'*':'none'
},
'margin':{
'*':'none'
},
'border':{
// '*':'none'
}
};
for(var i in items){
for(var j in items[i]){
$(j).css(i,items[i][j]);
}
}