Website/app/frontend/controllers/Components/BurgerMenu_controller.ts

21 lines
577 B
TypeScript
Raw Normal View History

import {Controller} from '@hotwired/stimulus';
export default class extends Controller {
static targets: Array<string> = ['container'];
declare readonly containerTarget: HTMLElement;
connect(): void {
console.log('Init Burgers');
this.containerTarget.style.left = '';
this.containerTarget.style.right = `-${this.containerTarget.offsetWidth}px`;
}
open(): void {
this.containerTarget.style.right = '0';
}
close(): void {
this.containerTarget.style.right = `-${this.containerTarget.offsetWidth}px`;
}
}