GithubHelp home page GithubHelp logo

[Component] Carousel about cssui HOT 7 OPEN

zetareticoli avatar zetareticoli commented on May 12, 2024
[Component] Carousel

from cssui.

Comments (7)

omaxel avatar omaxel commented on May 12, 2024 1

Great job @zetareticoli!

Here are my questions and comments on the implementation:

  1. Is there a particular reason for which you used :before and :after pseudo-selectors on [data-carousel] to display the previous and next button's icons? Couldn't we do the same styling the buttons using [data-slide-arrow]? A problem with the current approach is the clickable area: since :before and :after are rotated, the clickable area is different compared to the actual button. This makes it possible to implement the third point of this list too.
  2. I know you are exploring more on dots nav, but I noticed that when I'm on the third slide, the first and the third dots nav are white, while the second and the fourth are black.
  3. On Windows, the dots are displayed above the bottom horizontal scroll-bar. Also, I'm not sure it should have position: fixed, I would expect it to have position: absolute instead. This would allow the dots to be positioned relative to the carousel instead of the root document element.
  4. On the latest and first slides, I would enforce the feedback on the disabled arrow button. As of now, they are styled like a normal state button.
  5. [data-slides] elements have scroll-snap-padding applied. The correct property name should be scroll-padding. I tried fixing the property name and it breaks the carousel scroll.

I hope you find them useful. Thanks a lot!

from cssui.

argyleink avatar argyleink commented on May 12, 2024 1

here's some more inspo https://css-tricks.com/css-only-carousel/

from cssui.

zetareticoli avatar zetareticoli commented on May 12, 2024

Consider this example https://codepen.io/t_afif/pen/NWvQewg

from cssui.

zetareticoli avatar zetareticoli commented on May 12, 2024

I worked on a basic component structure and style.

Here you can find a preview: https://codepen.io/zetareticoli/pen/oNGVyOz?editors=1100

@omaxel What do you think with the result?

from cssui.

zetareticoli avatar zetareticoli commented on May 12, 2024

I've made some changes to the component:

  • Added PREV/NEXT arrows
  • Fixed padding bug

See the preview: https://codepen.io/zetareticoli/pen/oNGVyOz

I'll explore more the dots nav, making it with <input type="radio"> to simulate the checked state

@omaxel feedback welcome 🙏

from cssui.

zetareticoli avatar zetareticoli commented on May 12, 2024

Great job @zetareticoli!

Here are my questions and comments on the implementation:

  1. Is there a particular reason for which you used :before and :after pseudo-selectors on [data-carousel] to display the previous and next button's icons? Couldn't we do the same styling the buttons using [data-slide-arrow]? A problem with the current approach is the clickable area: since :before and :after are rotated, the clickable area is different compared to the actual button. This makes it possible to implement the third point of this list too.

Yes, the reason is that using the pseudo-elements on [data-slide-arrow] they got repeated for each slide.
The downside is the effect you highlighted at point 4 (no visual feedback on first/last slide).

  1. I know you are exploring more on dots nav, but I noticed that when I'm on the third slide, the first and the third dots nav are white, while the second and the fourth are black.

At the moment, I added the active style using :target pseudo-class. Don't know how to deal it without (scrolling and first element active by default. Any suggestions?

  1. On Windows, the dots are displayed above the bottom horizontal scroll-bar. Also, I'm not sure it should have position: fixed, I would expect it to have position: absolute instead. This would allow the dots to be positioned relative to the carousel instead of the root document element.

This is just a workaround because using absolute generates a bug where the dots appear in the first slide only. Need to investigate more...

from cssui.

zetareticoli avatar zetareticoli commented on May 12, 2024

Worked on another demo: https://codepen.io/zetareticoli/pen/bGYKOQR?editors=1100

It's total different approach, using radio buttons to manage sliding effect and indicators. Thus, it isn't touch sensitive for mobile devices 🤔

from cssui.

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.