yonicd / slickR

slick carousel htmlwidget for R
https://yonicd.github.io/slickR/
Other
158 stars 14 forks source link

Jump to specific carousel #40

Closed tsolloway closed 4 years ago

tsolloway commented 4 years ago

Is it possible to jump to a specific carousel, in a slick_list using an observeEvent?

yonicd commented 4 years ago

Slickr returns to shiny observers from the widget such as active element and relative location in the slick.

An example of this is in the shiny vignette of the package

# Observe the active slick

# The htmlwidget is observed by shiny and information can be retrieved. 

# Using the output name you set for the `renderSlick` object in this example
# it is `output$slick_output`

# Using this you can interact server-side "on click" of the active carousel
# by accessing elements in `input$slick_output_current$`

# `.clicked_slide`   : The index of the clicked element|
# `.relative_clicked`: The relative position of the clicked element|
# `.center_slide`    : The index of the center element|
# `.total_slide`     : The total number of elements in the carousel|
# `.active_slide`    : The ID of the active carousel|

Another option is to initialize it on a specific element.

You would need to add your own JavaScript calls to manipulate the carousel once it has been rendered.

tsolloway commented 4 years ago

cool. Thanks!