Search code examples
javascripthtmlcsscanvaspackery

Canvas ends up too large to write to when using infinite-scroll


For my tumblr theme, I'm drawing stuff on the canvas for the background, but with infinite-scroll it doesn't take too long before the canvas is too large to be drawn on (depending on browser etc. - haven't hit the limit in Chrome yet).

I'm using the canvas because it was suggested for filling in gaps between posts (in packery) here, but I was wondering whether it would be a much worse solution to create an absolutely positioned element with blocks with backgrounds instead, destroying and recreating on resize/re-layout.

What would be the best solution? Should I create more canvases on the fly in javascript whenever more posts are loaded, and if so, what would be the best method to do this? Would it be a horrible idea to scrap the canvas and use absolutely positioned elements instead?


Solution

  • The correct answer seems to have been, "don't use canvas, you idiot."

    So I redid the thing with absolutely positioned div elements. Case closed.