* @param {Number} [x] x-position relative to top-left of window (optional) * @param {Number} [y] y-position relative to top-left of window (optional) * @param {String} [positionType] it can be static, fixed, relative, sticky, initial or inherit (optional) * @chainable
(...args)
| 744 | * @chainable |
| 745 | */ |
| 746 | position(...args) { |
| 747 | if (args.length === 0) { |
| 748 | return { x: this.elt.offsetLeft, y: this.elt.offsetTop }; |
| 749 | } else { |
| 750 | let positionType = 'absolute'; |
| 751 | if ( |
| 752 | args[2] === 'static' || |
| 753 | args[2] === 'fixed' || |
| 754 | args[2] === 'relative' || |
| 755 | args[2] === 'sticky' || |
| 756 | args[2] === 'initial' || |
| 757 | args[2] === 'inherit' |
| 758 | ) { |
| 759 | positionType = args[2]; |
| 760 | } |
| 761 | this.elt.style.position = positionType; |
| 762 | this.elt.style.left = args[0] + 'px'; |
| 763 | this.elt.style.top = args[1] + 'px'; |
| 764 | this.x = args[0]; |
| 765 | this.y = args[1]; |
| 766 | return this; |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | /** |
| 771 | * Shows the current element. |
no outgoing calls
no test coverage detected