Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shiny: carousel collapses / folds after clicking on different tab and returning to carousel page #65

Open
chikkinen opened this issue Apr 28, 2022 · 1 comment

Comments

@chikkinen
Copy link

When clicking on a different tab in the nav bar, and then returning to the 'homepage' with the slick carousel, the carousel 'collapses' or 'folds'. As shown in the GIF below, the texts and images overlap. This only takes a few seconds and after that it works as expected. However, it does not occur every time (2 out of 3) and on start-up it works perfectly.

Can this be prevented?

slickR_issue_blurred

Using renderSlickR in server:

output$slideshow <- renderSlickR({
  opts <- settings(
    autoplay = TRUE,
    initialSlide = 0,
    slidesToShow = 3,
    slidesToScroll = 1,
    focusOnSelect = TRUE,
    arrows = TRUE)

  slides_dom <- slick_list(
    mapply(create_slides, stock_newest$MAKE, stock_newest$MODEL, stock_newest$COLOR_PHOTO, stock_newest$UPLOADDATE)
  )
  
  slickR(slides_dom) + opts
})

UI of slides:

create_slides <- function(make, model, image, date_added) {
    tagList(
        htmltools::tags$div(
            class = "col-sm-12",
            htmltools::tags$div(
                style = 'min-height:250px',
                class="well",
                htmltools::tags$div(
                    class = 'row',
                    htmltools::tags$p(paste('Toegevoegd op', format(date_added, '%d-%m')), style="font-size:12px; color:#808080"),
                    htmltools::tags$div(
                        class = "col-sm-4",
                        htmltools::tags$img(src = image, height = 110)
                    ),
                    htmltools::tags$div(
                        class = "col-sm-8",
                        htmltools::tags$h2(make, class= 'bold'),
                        htmltools::tags$h3(model, class= 'bold')
                    )
                )
            )
        )
    )
}

Show output with slickROutput:

div(
  slickROutput(ns("slideshow")), style = "height:300px"
)
@zhiyongli1995
Copy link

I met the same problem. Waitting for solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants