html2canvas error: Uncaught Error: IndexSizeError: DOM Exception 1

前端 未结 4 1781
慢半拍i
慢半拍i 2020-12-19 04:44

I am using html2canvas to convert a div on a canvas. Like this:




        
4条回答
  •  死守一世寂寞
    2020-12-19 04:56

    I had same problem. Problem is happened when I tried to use canvas inside a hidden element. In my case I am using Bootstrap modal and the canvas inside it.

    Solution is: "Implement canvas codes after element is fully visible".

    In my case I have to use $('.modal').on('shown.bs.modal', function(){}) instead of $('.modal').on('show.bs.modal', function(){}), because modal element is fully appeared on shown.bs.modal event ; )

提交回复
热议问题