No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to use @slide(index, direction) in carousel

    Help
    2
    3
    1151
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dsahoo last edited by

      I am trying to figure out how to use @slide(index, direction) event in carousel component to get the index of the current slide. Also, I am trying to run a callback on swipe of every carousel item to update the state with the current carousel item index

      1 Reply Last reply Reply Quote 0
      • benoitranque
        benoitranque last edited by

        Quick example:

        <q-carousel class="text-white" @slide="myAwesomeSlideMethod">
          <div slot="slide" class="bg-primary">
            Slide 1
          </div>
          <div slot="slide" class="bg-secondary">
            Slide 2
          </div>
          <div slot="slide" class="bg-tertiary">
            Slide 3
          </div>
        </q-carousel>
        
        methods: {
          myAwesomeSlideMethod (index, direction) {
            console.log(`Sliding to slide ${ index } using direction ${ direction }`)
          }
        }
        
        1 Reply Last reply Reply Quote 2
        • D
          dsahoo last edited by

          Thanks alot…

          1 Reply Last reply Reply Quote 0
          • First post
            Last post