No se aplica el estilo superior ni inferior. ¿Cómo puedo arreglar esto?
let btn = document.createElement("button"); btn.textContent = "Button"; btn.style.position = "fixed"; if (this.anchorBottom) { btn.style.bottom = this.y; console.log(true) } else { btn.style.top = this.y; } btn.style.right = 0; document.body.appendChild(btn);Proporcione una unidad también.
let btn = document.createElement("button"); btn.style.position = "fixed"; if (this.anchorBottom) { btn.style.bottom = `${this.y}px`; console.log(true) } else { btn.style.top = `${this.y}px`; } btn.style.right = '0px'; document.body.appendChild(btn); Recuerde, no está limitado a usar solo valores px .