-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Milestone
Description
Nature of issue?
- Found a bug
Most appropriate sub-area of p5.js?
- Core/Environment/Rendering
Which platform were you using when you encountered this?
- Desktop/Laptop
Details about the bug:
- p5.js version: current CDN version
- Web browser and version: 71.0.3578.98 (Official Build) (64-bit)
- Operating System: macOS 10.14.2
- Steps to reproduce this:
Setting the following CSS is the only way to have the canvas bound to the top left corner of the current view.
canvas {
position: fixed;
top: 0;
left: 0;
z-index: -1;
}the corresponding setup() function does not work by itself.
function setup() {
canvas = createCanvas(windowWidth, windowHeight);
canvas.style('position', 'fixed');
canvas.style('top', '0');
canvas.style('left', '0');
canvas.style('z-index', '-1');
}So only by setting the styling in CSS does the created canvas actually honour it. When set using canvas.style() the canvas does correctly reposition to the top of the page, however, it does not follow the current scroll position as it does with the CSS method.