Sha256: 7b3c87bf68740dee6ad7686c0a592363aec255820e82f4df37372d07648fe191

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = [ "content" ]

  next() {
    this.contentTarget.scrollTo({ left: this.#scrollLeft + this.#slideSize, behavior: "smooth" })
  }

  previous() {
    this.contentTarget.scrollTo({ left: this.#scrollLeft - this.#slideSize, behavior: "smooth" })
  }  

  get #scrollLeft() {
    return this.contentTarget.scrollLeft
  }

  get #slideSize() {
    return this.contentTarget.clientWidth
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
css-zero-0.0.36 lib/generators/css_zero/add/templates/app/javascript/controllers/carousel_controller.js