canvas getContext(“2d”) returns null

前端 未结 5 2243
天命终不由人
天命终不由人 2020-12-05 17:53

I\'ve tried this a few different ways, but I keep getting stuck with the same error. I\'ve loaded an image to canvas before, but since I updated Safari a few days ago, I\'m

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 18:24

    Make sure javascript runs after the canvas HTML element

    This is bad

    
        
        
    
    

    This is good

    
        
        '
    
    

    This is basically how I fixed my problem

提交回复
热议问题