| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- 게시판
- CGIMALL
- #jQuery
- #해피CGI
- #cgimall
- #쇼핑몰
- 사이트제작
- #홈페이지
- 솔루션
- 이미지
- #image
- #솔루션
- #이미지
- 해피CGI
- #뉴스
- #동영상
- 웹솔루션
- 홈페이지제작
- CSS
- 해피씨지아이
- php
- #업종별
- javascript
- happycgi
- #happycgi
- #CSS
- #웹솔루션
- jquery
- #홈페이지제작
- 홈페이지
- Today
- Total
웹솔루션개발 25년 노하우! 해피CGI의 모든것
[해피CGI][cgimall] 클릭하면 아이콘이 나오는 바 애니메이션 Chat Bar Interaction 본문
[해피CGI][cgimall] 클릭하면 아이콘이 나오는 바 애니메이션 Chat Bar Interaction
해피CGI윤실장 2025. 12. 17. 09:03
+ 버튼을 클릭하면 아이콘이 나오는 바 애니메이션입니다.
소스를 변경하여 다양하게 응용 가능합니다.
HTML 구조
<nav class="chatbar">
<div class="control">
<a>
<svg>
<use xlink:href="#plus">
</svg>
</a>
<div class="text">
<input type="text" placeholder="Message">
</div>
<ul class="list">
<li>
<a href="">
<svg>
<use xlink:href="#video">
</svg>
</a>
</li>
<li>
<a href="">
<svg>
<use xlink:href="#photo">
</svg>
</a>
</li>
<li>
<a href="">
<svg>
<use xlink:href="#image">
</svg>
</a>
</li>
</ul>
</div>
</nav>
.
.
.
CSS(SCSS) 소스
.chatbar {
--primary: #275EFE;
--shadow: rgba(39, 94, 254, .2);
width: 276px;
position: relative;
padding: 20px;
border-radius: 42px;
background: var(--primary);
overflow: hidden;
transform-origin: 42px 50%;
box-shadow: 0 32px 48px -8px var(--shadow);
.control {
--rotate: 0deg;
position: relative;
transform-origin: 22px 22px;
transition: transform .45s ease;
transform: rotate(var(--rotate));
& > a {
display: flex;
justify-content: center;
align-items: center;
position: relative;
z-index: 1;
cursor: pointer;
width: 44px;
height: 44px;
border-radius: 50%;
background: rgba(#fff, .2);
svg {
width: 28px;
height: 28px;
display: block;
color: #fff;
}
}
.text,
.list {
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 0 0 0 64px;
transform-origin: 22px 50%;
}
.text {
top: -6px;
input {
line-height: 24px;
padding: 14px 22px;
border: 0;
border-radius: 26px;
background: rgba(#fff, .2);
display: block;
color: #fff;
font-size: 18px;
outline: none;
width: 100%;
&::placeholder {
color: rgba(#fff, .4);
opacity: 1;
}
}
}
.list {
margin: 0;
list-style: none;
display: flex;
justify-content: space-between;
transform: rotate(135deg);
li {
--y: 0;
transition: transform 1s ease;
transform: translateY(var(--y));
a {
display: flex;
justify-content: center;
align-items: center;
width: 44px;
height: 44px;
border-radius: 50%;
background: rgba(#fff, .2);
svg {
width: 20px;
height: 20px;
display: block;
color: #fff;
stroke-linecap: round;
stroke-width: 1.2;
stroke-linejoin: round;
}
}
&:nth-child(2) {
--y: 8px;
}
&:nth-child(3) {
--y: 16px;
}
}
}
}
&.active {
animation: top 1s ease-in-out forwards;
.control {
--rotate: -135deg;
.list {
li {
--y: 0;
}
}
}
&.default {
animation: down 1s ease-in-out forwards;
.control {
--rotate: 0deg;
}
}
}
}
@keyframes top {
0%,
100% {
transform: rotate(0deg);
}
50%,
60% {
transform: rotate(-6deg);
}
88% {
transform: rotate(1deg);
}
}
@keyframes down {
0%,
100% {
transform: rotate(0deg);
}
50%,
60% {
transform: rotate(6deg);
}
88% {
transform: rotate(-1deg);
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
&:before,
&:after {
box-sizing: inherit;
}
}
// Center & dribbble
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #E4ECFA;
.dribbble {
position: fixed;
display: block;
right: 20px;
bottom: 20px;
img {
display: block;
height: 28px;
}
}
}
JS 소스
$('.chatbar .control > a').on('click touch', function(e) {
e.preventDefault();
let parent = $(this).parent().parent();
if(parent.hasClass('active')) {
parent.addClass('default');
setTimeout(() => {
parent.removeClass('active default');
}, 1000);
} else {
parent.addClass('active');
}
});
첨부파일을 다운로드하거나 해당 사이트로 이동하여 전체 소스를 확인하실 수 있습니다.
'웹프로그램밍 자료실 > 기타 자료' 카테고리의 다른 글
| [해피CGI][cgimall] Interactive Blackhole (0) | 2025.12.19 |
|---|---|
| [해피CGI][cgimall] 로딩되기 전에 애니메이션 구현하기 Skeleton loading using only a few lines of CSS (0) | 2025.12.18 |
| [해피CGI][cgimall] 소음진동,대기질,온실가스 등 61종의 환경영향평가 데이터 제공 - OPEN API (0) | 2025.12.15 |
| [해피CGI][cgimall] designus 디자이너스 국내 ui/ux 벤치마킹 사이트 (0) | 2025.12.02 |
| [해피CGI][cgimall] YouTube Studio: 저작권 걱정 없는 무료 음원 보물창고 (0) | 2025.11.19 |

