2023. 11. 29. 20:47ใDevelopment๐ฉ๐ป๐ฆณ/Dynamic Web
์น์ฌ์ดํธ์ ํต์ฌ ์์: FOOTER, LOGOS, ๋ค๋น๊ฒ์ด์
๋ฉ๋ด ๊ตฌํํ๊ธฐ
์น ๊ฐ๋ฐ์ ์ธ๊ณ์์, ์ฌ์ฉ์ ๊ฒฝํ(UX)๋ ์ต์ฐ์ ์
๋๋ค. ์ค๋์ ์น์ฌ์ดํธ์์ ์ค์ํ ์ธ ๋ถ๋ถ์ธ FOOTER, LOGOS, ๊ทธ๋ฆฌ๊ณ ๋ค๋น๊ฒ์ด์
๋ฉ๋ด๋ฅผ ์ด๋ป๊ฒ ๊ตฌํํ๋์ง ์ดํด๋ณด๊ฒ ์ต๋๋ค.
1. FOOTER์ ์ค์์ฑ๊ณผ ๊ตฌํ
์น์ฌ์ดํธ์ ํ๋จ์ ์์นํ๋ FOOTER๋ ์ฌ์ฉ์์๊ฒ ์ ์ฉํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ ์ค์ํ ์์ญ์
๋๋ค. ์ฌ๊ธฐ์๋ ์ ์๊ถ ์ ๋ณด, ์ฐ๋ฝ์ฒ, ์ฌ์ดํธ ๋งต, ์์
๋ฏธ๋์ด ๋งํฌ ๋ฑ์ด ํฌํจ๋ ์ ์์ต๋๋ค. ํจ๊ณผ์ ์ธ FOOTER ๋์์ธ์ ์ฌ์ฉ์์ ์น์ฌ์ดํธ ํ์์ ๋๊ณ , ํ์ํ ์ ๋ณด๋ฅผ ์ฝ๊ฒ ์ฐพ์ ์ ์๋๋ก ํฉ๋๋ค.
(์ด์ ์ฝ๋์ฌ์ฉ์ ๋ฉ๋ด๋ฐ๊ฐ ์ด๋ฆฐ์ดํ ํ๋จ ์คํฌ๋กค๋ง์ ํจ๊ป ๋ธ๋ฌ์ฒ๋ฆฌ๊ฐ๋์ ํ๋ฉด๊ตฌ์ฑ์ด ํฌ๋ช ํ๊ฒ ๋ณด์ด๋ ์ค๋ฅ๋ฅผ
์ ์์ค ๋ง๋๊ฒ ๋์์ต๋๋ค ์๋ฐ์คํฌ๋ฆฝํธ์ฝ๋์ ๊ทธ๋์ ๋ฉ๋ด๊ฐ ์ด๋ฆฌ๊ณ ๋ซํ๋ ๋ธ๋ฌํจ๊ณผ๊ฐ ์ ์ฉ๋๊ณ ์ ๊ฑฐ๋๋๋ก ๋ค์ ์ค๊ณํ์์ต๋๋ค)
2. LOGOS ์น์
LOGOS ์น์
์ ๋ธ๋๋ ์ธ์ง๋๋ฅผ ๋์ด๋ ๋ฐ ์ค์ํ ์ญํ ์ ํฉ๋๋ค. ์ฌ๊ธฐ์์๋ ์น์ฌ์ดํธ๊ฐ ํ๋ ฅํ๋ ๋ค์ํ ๋ธ๋๋๋ ํ์์ฌ์ ๋ก๊ณ ๋ฅผ ํ์ํ ์ ์์ต๋๋ค. ๋ก๊ณ ๋ ์๊ฐ์ ์ผ๋ก ๋งค๋ ฅ์ ์ด๋ฉด์๋ ์น์ฌ์ดํธ์ ์ ๋ฐ์ ์ธ ๋์์ธ๊ณผ ์กฐํ๋ฅผ ์ด๋ฃจ์ด์ผ ํฉ๋๋ค.
3. ๋์ ์ธ ๋ค๋น๊ฒ์ด์
๋ฉ๋ด
์ฌ์ฉ์์ ์น์ฌ์ดํธ ๋ด ํ์์ ์ฝ๊ฒ ๋ง๋๋ ์์ ์ค ํ๋๋ ๋ค๋น๊ฒ์ด์
๋ฉ๋ด์
๋๋ค. ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ์ด์ฉํด ๋ฉ๋ด๋ฅผ ํจ๊ณผ์ ์ผ๋ก ์ ์ดํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ๋ฉ๋ด ํ์ ๋ฐ ์จ๊น, ๋ธ๋ฌ ํจ๊ณผ ์ ์ฉ, ๋ชจ๋ฐ์ผ์์์ ๋ฉ๋ด ๊ด๋ฆฌ ๋ฑ์ด ์์ต๋๋ค. ์ด๋ฌํ ๊ธฐ๋ฅ์ ์น์ฌ์ดํธ์ ์ฌ์ฉ์ ์นํ์ฑ์ ํฌ๊ฒ ํฅ์์ํต๋๋ค.
์ด ํฌ์คํธ์์๋ ๊ฐ ์น์
์ ๊ตฌ์ฒด์ ์ธ ๊ตฌํ ๋ฐฉ๋ฒ๊ณผ ์ฝ๋ ์์๋ฅผ ์ ๊ณตํ๊ฒ ์ต๋๋ค. ์น ๊ฐ๋ฐ์ ๊ด์ฌ ์๋ ๋ถ๋ค์๊ฒ ์ด ์ ๋ณด๊ฐ ๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
๋ณ๊ฒฝ๋ ์๋ฐ์คํฌ๋ฆฝํธ ์ฝ๋
const navMenu = document.getElementById('nav-menu'),
navToggle = document.getElementById('nav-toggle'),
navClose = document.getElementById('nav-close'),
header = document.getElementById('header'); // ํค๋ ์์
/*===== MENU SHOW =====*/
/* Validate if constant exists */
if(navToggle){
navToggle.addEventListener('click', () =>{
navMenu.classList.add('show-menu');
header.style.backdropFilter = 'none'; // ๋ฉ๋ด๊ฐ ์ด๋ฆด ๋ ๋ธ๋ฌ ํจ๊ณผ ์ ๊ฑฐ
})
}
/*===== MENU HIDDEN =====*/
/* Validate if constant exists */
if(navClose){
navClose.addEventListener('click', () =>{
navMenu.classList.remove('show-menu');
header.style.backdropFilter = 'blur(10px)'; // ๋ฉ๋ด๊ฐ ๋ซํ ๋ ๋ธ๋ฌ ํจ๊ณผ ์ ์ฉ
})
}
/*===== SCROLL EVENT FOR BLUR EFFECT =====*/
window.addEventListener('scroll', () => {
if (!navMenu.classList.contains('show-menu')) {
// ๋ฉ๋ด๊ฐ ๋ซํ ์์ ๋ ์คํฌ๋กค์ ๋ฐ๋ผ ๋ธ๋ฌ ํจ๊ณผ ์กฐ์
header.style.backdropFilter = window.scrollY > 50 ? 'blur(10px)' : 'none';
}
});
/*=============== REMOVE MENU MOBILE ===============*/
const navLink = document.querySelectorAll('.nav__link')
const linkAction = () =>{
const navMenu = document.getElementById('nav-menu')
// When we click on each nav__link, we remove the show-menu class
navMenu.classList.remove('show-menu')
}
navLink.forEach(n => n.addEventListener('click', linkAction))
/*=============== CHANGE BACKGROUND HEADER ===============*/
function scrollHeader () {
const header = document.getElementById('header')
// When the scroll is greater than 50 viewport height, add the scroll-header class to the header tag
if(this.scrollY >= 50) header.classList.add('scroll-header');
else header.classList.remove('scroll-header')
}
window.addEventListener('scroll', scrollHeader)
/*=============== CHANGE BACKGROUND HEADER ===============*/
document.querySelectorAll('.home__car-number').forEach(number => {
const updateCount = () => {
const target = +number.getAttribute('data-target');
const count = +number.innerText;
const increment = target / 100;
if (count < target) {
number.innerText = Math.ceil(count + increment);
number.classList.add('is-visible'); // ์ฌ๊ธฐ์ ํด๋์ค ์ถ๊ฐ
setTimeout(updateCount, 10);
} else {
number.innerText = target;
number.classList.add('is-visible'); // ๋ชฉํ์ ๋๋ฌํ์ ๋๋ ํด๋์ค ์ถ๊ฐ
}
};
updateCount();
});
/*=============== POPULAR SWIPER ===============*/
let swiperPopular = new Swiper(".popular__container", {
loop: true,
spaceBetween: 24,
slidesPerView: 'auto',
grabCursor: true,
pagination: {
el: ".swiper-pagination",
dynamicBullets: true,
},
breakpoints: {
768: {
slidesPerView: 3,
},
1024: {
spaceBetween: 48,
},
},
});
/*=============== MIXITUP FILTER FEATURED ===============*/
let mixerFeatured = mixitup('.featured__content', {
selectors: {
target: '.featured__card'
},
animation: {
duration: 300
}
});
/* Link active featured */
const linkFeatured = document.querySelectorAll('.featured__item')
function activeFeatured(){
linkFeatured.forEach(l=> l.classList.remove('active-featured'))
this.classList.add('active-featured')
}
linkFeatured.forEach(l=> l.addEventListener('click',activeFeatured))
/*=============== SHOW SCROLL UP ===============*/
const scrollUp = () =>{
const scrollUp = document.getElementById('scroll-up')
// When the scroll is higher than 350 viewport height, add the show-scroll class to the a tag with the scrollup class
this.scrollY >= 350 ? scrollUp.classList.add('show-scroll')
: scrollUp.classList.remove('show-scroll')
}
window.addEventListener('scroll', scrollUp)
/*=============== SCROLL SECTIONS ACTIVE LINK ===============*/
const sections = document.querySelectorAll('section[id]')
const scrollActive = () =>{
const scrollDown = window.scrollY
sections.forEach(current =>{
const sectionHeight = current.offsetHeight,
sectionTop = current.offsetTop - 58,
sectionId = current.getAttribute('id'),
sectionsClass = document.querySelector('.nav__menu a[href*=' + sectionId + ']')
if(scrollDown > sectionTop && scrollDown <= sectionTop + sectionHeight){
sectionsClass.classList.add('active-link')
}else{
sectionsClass.classList.remove('active-link')
}
})
}
window.addEventListener('scroll', scrollActive)
/*=============== OFFER ===============*/
.offer{
position: relative;
}
.offer__container{
grid-template-rows: max-content 224px;
}
.offer__bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.offer__data,
.offer__img{
position: relative;
}
.offer__data{
text-align: center;
}
.offer__title{
margin-bottom: 2rem;
}
.offer__description{
margin-bottom: 3rem;
}
.offer__img{
position: absolute;
max-width: initial;
width: 400px;
bottom: 2rem;
right: -5.5rem;
}
/*=============== LOGOS ===============*/
.logos__img{
width: 40px;
opacity: .4;
transition: .3s;
}
.logos__container{
grid-template-columns: repeat(3, max-content);
justify-content: center;
align-items: center;
gap: 4rem;
padding-bottom: 2rem;
}
.logos__img:hover{
opacity: 1;
}
/*=============== FOOTER ===============*/
.footer{
position: relative;
overflow: hidden;
}
.footer .shape__big,
.footer .shape__small{
position: absolute;
}
.footer .shape__big{
width: 300px;
height: 300px;
left: -12rem;
top: 6rem;
}
.footer .shape__small{
right: -13rem;
bottom: -6rem;
}
.footer__container{
row-gap: 2.5rem;
position: relative;
}
.footer__logo{
display: inline-flex;
align-items: center;
column-gap: .25rem;
color: var(--title-color);
font-size: var(--h2-font-size);
font-weight: var(--font-semi-bold);
margin-bottom: 1.25rem;
transition: .3s;
}
.footer__logo i{
font-size: 1.5rem;
font-weight: 500;
}
.footer__logo:hover{
color: var(--first-color);
}
.footer__title{
font-size: var(--h3-font-size);
margin-bottom: 1.25rem;
}
.footer__links{
display: flex;
flex-direction: column;
row-gap: .5rem;
}
.footer__link,
.footer__social-link{
color: var(--text-color);
transition: .3s;
}
.footer__link:hover,
.footer__social-link:hover{
color: var(--title-color);
}
.footer__social{
display: flex;
column-gap: 1.5rem;
}
.footer__social-link{
font-size: 1.25rem;
}
.footer__copy{
display: block;
margin-top: 4.5rem;
text-align: center;
font-size: var(--small-font-size);
color: var(--text-color-light);
}
/*=============== SCROLL BAR ===============*/
::-webkit-scrollbar{
width: .6rem;
background-color: hsl(219, 4%, 16%);
border-radius: 1rem;
}
::-webkit-scrollbar-thumb{
background-color: hsl(219, 4%, 24%);
}
::-webkit-scrollbar-thumb:hover{
background-color: hsl(219, 4%, 32%);
}
/*=============== SCROLL UP ===============*/
.scrollup{
position: fixed;
right: 1rem;
bottom: -30%;
background-color: hsla(0, 0%, 100%, .1);
backdrop-filter: blur(16px);
display: inline-flex;
padding: .45rem;
border-radius: .5rem;
font-size: 1.15rem;
color: var(--white-color);
z-index: var(--z-tooltip);
transition: .4s;
}
.scrollup:hover{
transform: translateY(-.25rem);
}
/* Show Scroll Up*/
.show-scroll{
bottom: 3rem;
}
์คํ์ผ๋ง์ ์ถ๊ฐํ์ต๋๋ค
Featured Luxury Cars
์๋ก์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ kunkalabs๋ฅผ ์ฌ์ฉํ์ฌ Featured Luxury Cars๋ฉ๋ด๋ฅผ ๊ตฌ์ฑํ์์ต๋๋ค
๋ฒํผ ๊ตฌํ์์ฒด๊ฐ ๋งค์ฐ ๋ถ๋๋ฝ๊ฒ๋ฉ๋๋ค ใ ใ
ํด๋ฆญ์ ์ปฌ๋ฌ๊ฐ ์์ฐ์ค๋ฝ๊ฒ ์ฝ์ ๋๋ฉด์ ์ฌ๋ผ์ค๋๊ฒ ์์๋ค๊ณ ์๊ฐ๋ฌ๋ ๋ถ๋ถ์ค ํ๋์ ๋๋ค
์ฌ์ฉ๋ ํจ์ ๋ฆฌ๋ทฐํด๋ณด์๋ฉด
const linkFeatured = document.querySelectorAll('.featured__item'): .featured__item ํด๋์ค๋ฅผ ๊ฐ์ง ๋ชจ๋ ์์๋ฅผ ์ ํํ๊ณ , linkFeatured ์์์ ์ด๋ค์ ๋ชฉ๋ก์ ์ ์ฅํฉ๋๋ค.
function activeFeatured() { ... }: activeFeatured๋ผ๋ ํจ์๋ฅผ ์ ์ํฉ๋๋ค.
์ด ํจ์๋ ํด๋ฆญ๋ ์์์ 'active-featured' ํด๋์ค๋ฅผ ์ถ๊ฐํ๊ณ , ๋ค๋ฅธ ๋ชจ๋ ์์์์ ์ด ํด๋์ค๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
linkFeatured.forEach(l => l.classList.remove('active-featured')): linkFeatured์
์ ์ฅ๋ ๋ชจ๋ ์์๋ฅผ ์ํํ๋ฉด์, ๊ฐ ์์์์ 'active-featured' ํด๋์ค๋ฅผ ์ ๊ฑฐํฉ๋๋ค.
this.classList.add('active-featured'): ํ์ฌ ํด๋ฆญ๋ ์์(this๋ฅผ ํตํด ์ฐธ์กฐ)์ 'active-featured' ํด๋์ค๋ฅผ ์ถ๊ฐํฉ๋๋ค.
์ด๋ ์ฌ์ฉ์๊ฐ ํด๋ฆญํ ์์๋ฅผ ์๊ฐ์ ์ผ๋ก ๊ฐ์กฐํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
linkFeatured.forEach(l => l.addEventListener('click', activeFeatured)): linkFeatured์ ์ ์ฅ๋ ๋ชจ๋ ์์์ ๋ํด
ํด๋ฆญ ์ด๋ฒคํธ ๋ฆฌ์ค๋๋ฅผ ์ถ๊ฐํฉ๋๋ค. ์ฌ์ฉ์๊ฐ ์ด ์์๋ค ์ค ํ๋๋ฅผ ํด๋ฆญํ๋ฉด activeFeatured ํจ์๊ฐ ์คํ๋์ด,
ํด๋ฆญ๋ ์์์ 'active-featured' ํด๋์ค๊ฐ ์ถ๊ฐ๋๊ณ ๋ค๋ฅธ ์์๋ค์์๋ ์ ๊ฑฐ๋ฉ๋๋ค.
์ด ์ฝ๋๋ ์ฌ์ฉ์๊ฐ 'featured' ์น์
์ ๋ค๋ฅธ ํญ๋ชฉ์ ํด๋ฆญํ ๋๋ง๋ค ์๊ฐ์ ํผ๋๋ฐฑ์ ์ ๊ณตํ์ฌ, ํ์ฌ ์ ํ๋ ํญ๋ชฉ์ ๋ช
ํํ๊ฒ ํ์ํฉ๋๋ค.
์ด๋ ๊ฒ ๋๋ฒ์งธ ํ๋ก์ ํธ๋ ์ฑํฉ๋ฆฌ์ ๋ง์ณค์ต๋๋ค
๋ค์ ํ๋ก์ ํธ๋ ๋ฆฌ์กํธ๋ก ๋์์ค๋๋ก ํ๊ฒ ์ต๋๋ค๐ค