I’ve found that there is a function called WebKitCSSKeyframesRule in the window object, but it seems that executing this function leads to an error. Does anyone know how this function works? Is there a good way to modify the keyframe of css3 animation?
I’ve found that there is a function called WebKitCSSKeyframesRule in the window object, but
Share
WebKitCSSKeyframesRuleisn’t a function: it’s a contructor that’s used internally when parsing stylesheets.To modify a
@keyframesrule, you have to find it first:Once you have your rule, you can modify, add, delete frame rules using the rule’s
cssRulesproperty and theaddRule,deleteRulemethods, like you usually do with common stylesheets:That’s the same as alerting
keyframesRule.cssRules[i].cssText.Obviously, this is all vendor prefixed, so for Firefox you’ll have to use
MozCSSKeyframesRuleinstead, and so on.