flowforfrank / webtips

https://webtips.dev
1 stars 0 forks source link

how-to-make-an-animated-day-and-night-toggle-switch #30

Open utterances-bot opened 4 months ago

utterances-bot commented 4 months ago

How to Make an Animated Day and Night Toggle Switch - Webtips

Learn how you can make an animated day and night toggle switch with CSS to switch between a light and a dark theme of your app.

https://webtips.dev/how-to-make-an-animated-day-and-night-toggle-switch

fez7yoe commented 4 months ago

Hello, after testing step by step according to the process, I found an issue. It seems that setting the corner radius of the .wave to 100% doesn't have any effect; the wave remains square with just a slight rounding.

flowforfrank commented 4 months ago

Hello, after testing step by step according to the process, I found an issue. It seems that setting the corner radius of the .wave to 100% doesn't have any effect; the wave remains square with just a slight rounding.

Hey @fez7yoe,

Thank you for your comment! You're correct, this seems to be a somewhat recent bug in Chromium. I tested the feature in Firefox and it works as expected. However, there are several ways we can work around this. For example, we could:

To give you a concrete example, we can change the CSS rules for the .wave element as follows to fix the issue in Chrome using the scaling solution:

.wave {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #212121;
    transition: transform .3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.wave.active {
    transform: scale(999);
}

The .active class applies a transform rule where the element is scaled up over time to recreate the same effect we originally had with the box-shadow property. Note that you can grab the full source code in one go in this GitHub repository.

Hope this helps. Please let me know if you have any further questions!