Sha256: e33d1d217b16a40d7c541fc9c7179d90760c7830add1260ee6c4fc16f6b7ae32
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 Bytes
Contents
import { Controller } from "stimulus" export default class extends Controller { static targets = ["content"] show(event) { event.preventDefault() event.stopImmediatePropagation() if (this.open) { event.currentTarget.textContent = "Show more 👇" this.contentTarget.scrollIntoView() this.contentTarget.style.height = null this.contentTarget.classList.remove("h-auto", "after:h-0") this.contentTarget.classList.add("h-120", "after:h-120") this.open = false } else { event.currentTarget.textContent = "Show less ☝️" this.contentTarget.style.height = this.contentTarget.scrollHeight + "px" this.contentTarget.classList.remove("h-120", "after:h-120") this.contentTarget.classList.add("h-auto", "after:h-0") this.open = true } } get open() { const openBool = (this.data.get("open") == "true") return openBool } set open(value) { this.data.set("open", value) } }
Version data entries
3 entries across 3 versions & 1 rubygems