๐Ÿ‘ฉ‍๐Ÿ’ป/CSS3

[CSS] ์š”์†Œ๋ฅผ fadeoutํ•œ ๋’ค์—๋„ ์—ฌ์ „ํžˆ clickableํ•  ๋•Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

ํ•œ๋‚˜ 2021. 3. 6. 12:11


๋ฌธ์ œ ์ƒํ™ฉ

๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ๋ฐ”๋กœ ์œ„์˜ ๋ฌธ๋‹จ์ด fade out ๋˜๋ฉด์„œ ์‚ฌ๋ผ์ ธ์•ผ ํ•˜๋Š”๋ฐ, ํ•ด๋‹น ๋ถ€๋ถ„์„ ๋“œ๋ž˜๊ทธํ•˜๋ฉด draggable ํ•˜๊ณ , ๋ณต์‚ฌ๊นŒ์ง€ ๋œ๋‹ค.

์ฝ”๋“œ

.fade {
    animation: fade ease 1s forwards;
}

@keyframes fade {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

์œ„ ์ฝ”๋“œ๋ฅผ ์•„๋ž˜์ฒ˜๋Ÿผ ๋ฐ”๊พผ๋‹ค.


@keyframes fade {
    from {
        opacity: 1;
        pointer-events: all;
    }
    to {
        opacity: 0;
        pointer-events: none;
    }
}

๋” ์ด์ƒ Clickable ํ•˜์ง€ ์•Š๋‹ค. pointer-events CSS ์†์„ฑ์€ ๊ทธ๋ž˜ํ”ฝ ์š”์†Œ๊ฐ€ ์–ด๋–ค ์ƒํ™ฉ์—์„œ ํฌ์ธํ„ฐ ์ด๋ฒคํŠธ์˜ ๋Œ€์ƒ์ด ๋  ์ˆ˜ ์žˆ๋Š”์ง€ ์ง€์ •ํ•ด์ฃผ๋Š” ์†์„ฑ์ด๋‹ค. (MDN)