有没有办法将样式重置为CSS中的内容?
例如:
#foo {width: 50px; height: 50px; position: absolute; top: 150px; left: 250px;}
function moveFoo(newpostop, newposleft){
$('foo').setStyle({top: newpostop+'px', left: newposleft+'px'});
}
现在我已经完成了它,我想把foo移回到原来的位置。我知道可以硬编码,但我需要对25个不同的div执行此操作。
谢谢
writeAttribute
会完全从 DOM 节点中删除style
属性,而其他答案只会删除其中某些设置。 - heiglandreas