728x90
CSS : ์ ๋๋ฉ๋์ ๋ง๋ค๊ธฐ : ๊ฑธ์ด๊ฐ๋ ํ ๋งคํ
์ด๋ฒ ์๊ฐ์๋ CSS์ค์ต์ผ๋ก ๊ท์ฌ์ด ๊ฑท๊ธฐ ์ ๋๋ฉ์ด์ ์ ๋ง๋ค์ด๋ณด๊ฒ ์ต๋๋ค. ๐
#1. HTML
๋ค์์ HTML ์ฝ๋ ์ ๋๋ค!
<div class="svgBox timing step">
<div class="stepbox"></div>
<span class="stepBtn">
<a href="#" class="stepBtnStart">Start</a>
<a href="#" class="stepBtnStop">Stop</a>
</span>
</div>
#2. CSS
๋ค์์ CSS ์ฝ๋ ์ ๋๋ค!
.step {
height: 700px;
background: #fde7ef;
position: relative;
}
.step .stepbox {
width: 800px; height: 600px;
background: url(https://user-images.githubusercontent.com/106949433/188998629-e1cb8ac8-0263-4b69-935d-eacd186c2535.jpg);
border-radius: 0;
position: absolute;
left: 50%; top: 50%;
transform: translate(-50%, -50%);
animation: ani 1s steps(24, start) infinite;
}
.step .stepbox.start {
animation-play-state: running;
}
.step .stepbox.stop {
animation-play-state: paused;
}
@keyframes ani {
0% {background-position: 0 0;}
100% {background-position: -19200px 0;}
}
.stepBtn {
position: absolute; left: 15px; top: 20px;
}
.stepBtn a {
background: #e16162; color: #fff;
padding: 10px;
margin: 3px;
border-radius: 3px;
}
#3. JavaScript
๋ค์์ ์๋ฐ์คํฌ๋ฆฝํธ ์ ๋๋ค!
$(".stepBtnStart").click(function(e){
e.preventDefault();
$(".stepbox").removeClass("stop").addClass("start");
});
$(".stepBtnStop").click(function(e){
e.preventDefault();
$(".stepbox").removeClass("start").addClass("stop");
});
728x90
'CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] ์ ๋๋ฉ์ด์ 05 : ๊น์ฆค๋๋ ์ ์ฒด ํจ๊ณผ (5) | 2022.09.21 |
---|---|
[CSS] ์ ๋๋ฉ์ด์ 04 : ์จ์ด๋ธ~~์จ์ด๋ธ~~ (6) | 2022.09.19 |
[CSS] CSS ์ ๋๋ฉ์ด์ ์ ๋ํด ์์๋ณด์! (4) | 2022.09.08 |
[CSS] SVG : ์ ๋๋ฉ์ด์ ๊ตฌํํ๊ธฐ (5) | 2022.09.08 |
[CSS] SVG : ๋ฐฑํฐ ๊ทธ๋ํฝ ๋ํ ํํํ๊ธฐ (5) | 2022.09.08 |
๋๊ธ