Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

"Operation is not supported" with getComputedStyle

"Operation is not supported" with getComputedStyle

Problem

I'm trying to get the current degrees from a rotaion-animation. Sadly Firefox tells me the following:

NotSupportedError: Operation is not supported
[Break On This Error]   

var style = window.getComputedStyle(el);

el is the following:

document.getElementById('spinner');

And #spinner is and image which is rotated by an animation:

 @-moz-keyframes spinmerightroundbaby{
    0%{ -moz-transform: rotate(0deg); } 
    100%{ -moz-transform: rotate(360deg);}
    }
    #spinner{
        -moz-animation: spinmerightroundbaby 30s linear 0s infinite;
    }

No other JScode is executed.

Would you please help me out?

Problem courtesy of: Frozen_byte

Solution

Rob W reminded me to check if the Element is "null" and so it was.

Easy to fix: I used the $(document).ready() function given by jQuery to defer the execution.
That worked fine.

Solution courtesy of: Frozen_byte

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

"Operation is not supported" with getComputedStyle

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×