Giter Club home page Giter Club logo

Comments (3)

yonicd avatar yonicd commented on June 11, 2024 1

i've been wondering how to get the arrows to show up. thanks for that (now it is part of the base css theme). i had my css set to 80% for the text align width.

I think it was to control the overlapping of the images, but padding takes care of that now.

now the padding is part of the margins that you see only when moving between images.

slickR::slickR(
  obj =  imgs,
  height=400, 
  width=600,
  slideId = 'ex1',
  slickOpts = list(
    dots = TRUE,
    arrows = TRUE,
    slidesToShow = 1,
    slidesToScroll = 1
  ) 
)

from slickr.

yonicd avatar yonicd commented on June 11, 2024

i added a padding parameter to control white space between images within the carousel.

imgs <- c('https://static.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg',
          'http://wallpoop.com/wp-content/uploads/2012/07/persian-kittens-.jpg',
          'http://i0.kym-cdn.com/photos/images/original/000/068/576/kittycat.jpg')

slickR::slickR(
  obj =  imgs,
  slideId = 'ex1',
  padding='1%',
  slickOpts = list(
    slidesToShow=1,
    centerMode = TRUE,
    dots = TRUE
  ), height=400, width='100%'
)

you also have the slickjs option of setting variableWidth=TRUE which will allow each image to be a different with, but i find that hard to control.

from slickr.

tiernanmartin avatar tiernanmartin commented on June 11, 2024

The padding param is helpful - thanks for adding it so quickly!

Unfortunately it didn't get me the result I was looking for. I didn't specify very clearly, so that's my bad. When I run your reprex I see the three images separated by white bars, like this:

slickR::slickR(
  obj =  imgs,
  slideId = 'ex1',
  padding='1%',
  slickOpts = list(
    slidesToShow=1,
    centerMode = TRUE,
    dots = TRUE
  ), height=400, width=600
)

slickr-01

What I was hoping to achieve was a carousel that only shows the focus image. After some tinkering I managed to do it by attaching a style tag to the htmlwidget like so:

slickR::slickR(
  obj =  imgs,
  height=400, 
  width=600,
  slideId = 'ex1',
  padding=0,
  slickOpts = list(
    dots = TRUE,
    arrows = TRUE,
    slidesToShow = 1,
    slidesToScroll = 1
  ) 
) %>% htmlwidgets::prependContent(htmltools::tags$style(".slick-list {text-align: center; width: 100% !important;}
                                                        .slick-prev:before, .slick-next:before {opacity: .25; color: #404040}"))

slickr-02

I'll be the first to admit this is a pretty inelegant solution. I think I'm basically trying to recreate the Single Item mode shown here.

If you have a cleaner way of doing this I'd love to hear it.

Thanks for the package!

from slickr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.