| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { position, place_top } from "./position.js";
- import { size, auto } from "./size.js";
- class sticky {
- #width;
- #height;
- #position;
-
- constructor() {
- this.#width = new auto();
- this.#height = new auto();
- this.#position = new place_top();
- }
- set width(value) {
- if (!(value instanceof size)) {
- throw "Width must be instance of size.";
- }
-
- this.#width = value;
- }
- set height(value) {
- if (!(value instanceof size)) {
- throw "Height must be instance of size.";
- }
- this.#height = value;
- }
- set position(value) {
- if (!(value instanceof position)) {
- throw "Position must be instance of position class.";
- }
- this.#position = value;
- }
- get element() {
- const container = document.createElement("div");
-
- container.style.width = this.#width.as_css;
- container.style.height = this.#height.as_css;
-
- container.style.position = "fixed";
- container.style.top = this.#position.top_css;
- container.style.bottom = this.#position.bottom_css;
- container.style.right = this.#position.right_css;
- container.style.left = this.#position.left_css;
- return container;
- }
- }
- export { sticky };
|