์ฌ์ดํธ๋ช
: ์๋ค๋ฅด
์์
๊ธฐ๊ฐ: 3์ผ ์์
๋ผ์ด๋ธ๋ฌ๋ฆฌ: swiper, jQuery
์ ํ: PC,mobile ์ ์ํ, ํด๋ก ์ฝ๋ฉ
์ฐธ์ฌ๋: 100%


$(window).scroll(function(){ if ($(this).scrollTop()>0) { //ํ์ฌ scrollTop๊ฐ์ด 0๋ณด๋ค ํด๋ $('.header, .gnb-area, .top-menu').addClass('active'); $('.menu-wrap').fadeIn(0); } else { $('.header, .gnb-area, .top-menu').removeClass('active'); } })
window๋ฅผ ๊ธฐ์ค์ผ๋ก ์คํฌ๋กค์ ๋ด๋ ธ์ ๋ ์คํฌ๋กค์ด ์ด๋ํ ๋งํผ์ ์คํฌ๋กค ์ ๊ฐ์ ๊ตฌํ๋ ๊ฒ
e.originalEvent.wheelDelta; //๋ง์ฐ์ค ํ ์ ๋ฐ์ดํฐ ๊ฐ์ ๋ฐ์์จ๋ค

$('html, body').on('mousewheel',function(e){
var E = e.originalEvent.wheelDelta; //๋ง์ฐ์ค ํ ์ ๋ฐ์ดํฐ ๊ฐ์ ๋ฐ์์จ๋ค
console.log(E);
//๋ฐ์ ๋ด๋ฆด๋๋ ์์ ์ฌ๋ฆด๋๋ ์์๊ฐ์ ๋ฐ์์จ๋ค
if (E > 0) {
$('.appear-tab').fadeOut();
} else {
$('.appear-tab').fadeIn();
}
});
์ฒ์ ์์์์ ๋ณด์ด์ง ์์์ผํ๋๋ฐ ์์๋ถํฐ ๋ํ๋ ์์๋ค.
๊ทธ ์ด์ ๋?
if (E < 0) {
$('.appear-tab').fadeOut();
} else {
$('.appear-tab').fadeIn();
}
๋ง์ฝ ๋ง์ฐ์ค ํ ๊ฐ์ด ์์์ผ๋
๋ด๋ฆด๋ -120 ์ฌ๋ฆด๋ 120
๋ด๋ฆด๋ -120<0 ์ฐธ fadeOut
์ฌ๋ฆด๋ 120<0 ๊ฑฐ์ง fadeIn ์ธ๊ฑด ๋ง์ง๋ง
0<0์ ๊ฑฐ์ง์์ผ๋ก ์์ํ ๋ ๋ํ๋์๋ ๊ฒ ์ด๋ค.
--โ์ค๋ฅโ--
์ด๋ ๊ฒ ์ฝ๋ ์์ฑ์ ๋ฉ๋ด์์ญ์์๋ ํ ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ๊ฒ ๋๋ค.
lastScroll = 0; //lastScroll์ด 0์ผ๋ $(window).scroll(function(){ curr = $(this).scrollTop(); //ํ์ฌscrollTop๊ฐ if (curr > lastScroll || curr == 0) { //ํ์ฌ๊ฐ์ด lastScroll๋ณด๋ค ํฌ๊ฑฐ๋ 0๊ณผ ๊ฐ๋ค๋ฉด $('.appear-tab').fadeOut(); //์ฌ๋ผ์ ธ๋ผ(๋ด๋ฆฌ๋ฉด } else { $('.appear-tab').fadeIn(); //์๋๋ผ๋ฉด ๋ํ๋๋ผ (์ฌ๋ฆฌ๋ฉด } lastScroll = curr; //lastScroll๊ฐ๊ณผ ํ์ฌ๊ฐ์ด ๊ฐ์์ผ ์คํ์ด ๋๋ค })โ lastScroll = curr;์ ์ฐ๋ ์ด์ ๋?
-> lastScroll์ ์๋ฌด ์กฐ๊ฑด์ ๊ฑธ์ด์ฃผ์ง ์์์์ผ๋ก lastScroll๋ 0์ผ๋ก ๋ฐ๋์ง ์๋๋ค. ๊ทธ๋ ๊ธฐ์ else ์กฐ๊ฑด์ ์ฑ๋ฆฝ๋์ง ์์->๊ทธ๋ ๊ธฐ์ ์กฐ๊ฑด๋ฌธ์ด ๋จผ์ ์คํ๋ ๋ค lastScroll์ ํ์ฌ๊ฐ์ ๋ด์์ฃผ๋ฉด ์กฐ๊ฑด์ด ์ฑ๋ฆฝ๋จ


์ด๋ถ๋ถ์ ์ค์์ดํผ๊ฐ ๊ฐ์ง๊ณ ์๋
swiper-pagination-bulletํด๋์ค๋ฅผ ์ฐพ์์
width,height,border-radius๋ฅผ ์ฃผ๋ฉด ๋๋ค.
<div class="swiper main-slide"> <ul class="swiper-wrapper slide-box"> <div class="swiper-pagination swiper-bar"></div> </ul> </div>
.sc-banner .main-slide .swiper-bar{ bottom: 37px; left: 50%; transform: translateX(-50%); } .swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet, .swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{ width: 20px; height: 2px; margin: 0; border-radius: 0; background: #fff; }ํด๋์ค๋ช ์ด ๊ธด ์ด์ ๋ ๊ธฐ์กด์ ์๋ ์ค์์ดํผcssํด๋์ค๋ช ๊ทธ๋๋ก ๊ฐ์ ธ์จ ๊ฑฐ๋ค.
swiper-pagination-bullet๋ฅผ ๊ฐ์ธ๊ณ ์๋swiper-pagination์ ์ฌ์ด์ฆ์ ์์ ์ฃผ๋ คํด์ ์๋๊ฒ



โ ์์๋ค์ ์ปจ๋๋กคํ ๋๋ ๋ถ๋ชจ์์๋ฅผ ๊ฑด๋๋๊ฒ ํธํ๋ค.
๋ถ๋ชจ์์๋ก ๋ฐ์ ์๋๋ค๊ณ ์๊ฐํ์.hidden-menu .ic-show.active .all-menu{display: block;}ex) ๋ถ๋ชจ์์ a๊ฐ ๋๋ ธ์๋ b๊ฐ ๋๋ผ, c๊ฐ ๋๋ผ โ O
ํ์ ์์ a๊ฐ ๋๋ ธ์๋ b์ฌ ๋๋ผ โ X
$('.hidden-menu .ic-show').click(function(e){
e.preventDefault();
$(this).toggleClass("active");
$('.bottom-menu').stop().slideToggle();
if ($(this).hasClass('active')) {
$('.all-menu').addClass("active");
$('.top-menu-list').addClass("active");
} else {
// $('bottom-menu').slideUp();
$('.all-menu').removeClass("active");
$('.top-menu-list').removeClass("active");
}
})
๋ค๋น๊ฒ์ด์
๋ฐ ๋์ณค์๋ ์ฌ๋ผ์ด๋๋ฅผ ๋ง๋ค์ด์ค๋ค.
์๋ค๋ฅด์์ ์ฌ๋ผ์ด๋๋ฐ๋ ์์ ์ค์ผํจ
box-sizing: border-box;
overflow-x: auto;
์์ฉ์ ๋ฐ์ค์๋ค๊ฐ ํด๋์ค ๋ฃ์ด์ฃผ๋ฉด๋จ
.box {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.box::-webkit-scrollbar {
display: none; /* Chrome, Safari, Opera*/
}
๋ฉ๋ด ๋ฒํผ์ ๋๋ ์๋ ์ผ์ชฝ์์ ์ค๋ฅธ์ชฝ์ผ๋ก ํผ์ณ์ง๊ธฐ
๋ค๋ฅธ ์น์
๋ค๋ณด๋ค ์ ์ผ ์์ ๋ ์์ด์ผํ๋ค.
->๋งํฌ์
์์ dimmed๋ฅผ ๋งจ์์ ์์น์ํจ๋ค.

โ ์ ์ฌ์ง๊ณผ ๊ฐ์ด ํ์ฑํ ๋ ์ฐฝ ์๋์ ์๋ ์ปจํ
์ธ ๋ค์ ์ด๋ก๊ฒ ์ค์ ํ๋, ํํ dimmed ๋ผ๊ณ ๋ถ๋ฆฌ์ด๋ค.
.dimmed{
position: fixed;
top: 0;left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3);
z-index: 20;
visibility: hidden;
opacity: 0;
transition: opactiy 0.3s;
}
/* ์ ์ด์ฟผ๋ฆฌ */
.dimmed.active{
opacity: 1;
visibility: visible;
}
body.hidden{ overflow: hidden; }
.header .sc-menu{
position: fixed;
left: 0;
top: 0;
z-index: 999;
width: 82%;
height: 100%;
/* display: none; */
transform: translateX(-100%);
transition: 0.3s;
background: #fff;
z-index: 9999;
overflow: auto; -> ๋ด์ฉ์ด ๋์น๋ฉด ๋ณด์ด์ง ์๊ธฐ ๋๋ฌธ์ ์คํฌ๋กค ์์ฑ
overflow-x: hidden;
}
์ ์ด์ฟผ๋ฆฌ
$('.link-menu').click(function(e){ //ํด๋ฆญํ์๋
e.preventDefault();
$('.sc-menu, .dimmed').addClass('active'); //ํผ์ณ์ง๋ active ์ถ๊ฐ
$('body').addClass('hidden');
})//END
$('.close, .dimmed').click(function(){ //๋ซํ ๋ฒํผ ํด๋ฆญ์
$('.sc-menu, .dimmed').removeClass('active'); //active ๋นผ๊ธฐ
$('body').removeClass('hidden');
})
๋ฐฉ๋ฌธ์์ ๋ก์ปฌ ์ปดํจํฐ์ ํฐํธ ์ค์น ์ฌ๋ถ์ ์๊ด ์์ด ์จ๋ผ์ธ์ ํน์ ์๋ฒ์ ์์นํ ํฐํธ ํ์ผ์ ๋ค์ด๋ก๋ํ์ฌ ํ๋ฉด์ ํ์ํด์ฃผ๋ ์น ์ ์ฉ ํฐํธ์ด๋ค.
โผ ์นํฐํธ์ ์ข ๋ฅ์ ์ง์ ๋ฒ์

ํฐํธ ํ์ผ์ ์ ์ฅํ์ฌ ์ง์ ๋ถ๋ฌ์ ์ ์ฉํ ์ ์๋ ๋ฐฉ๋ฒ์ด๋ค.
โผ ์ ์ฉ ๋ฐฉ๋ฒ
@font-face {
font-family: 'Gilroy-Medium';
//ํฐํธ ์ด๋ฆ์ ์ค์ ํ ์ ์๋ค.
_ ํ์ผ๋ช
๊ณผ ๋์ผํ๊ฒ ํ๋ ๊ฒ์ด ์ข์!
src: url(../font/Gilroy-Medium.woff2) format('woff2');
//ํฐํธ ํ์ผ์ ๊ฒฝ๋ก์ ํ์ผ ํ์
font-weight: 500;
//๊ฐ ํฐํธ์ ๊ตต๊ธฐ ํ์
};

โ ์๋ค๋ฅด๋ ๊ณตํต ๋ ์ด์์์ด ๋ง๋ค.
ํด๋์ค๋ช
์ ๊ณตํต์ผ๋ก ์ง์ ํด์ฃผ๋ฉด ๋ ์ฝ๊ณ ๋น ๋ฅด๊ฒ ๊พธ๋ฏธ๊ธฐ ๊ฐ๋ฅํด์ง๋ค.

์ค์์ดํผ์๋ ๊ฐ๋ก,์ธ๋ก ์ฌ์ด์ฆ๊ฐ ์ด๋ฏธ ๋ค์ด์๋๋ฐ
.swiper img {
width: 100%;
height: 85vh;
object-fit: cover;
background-image: cadetblue;
/* background-size: 100%; */
}
์ด๋ฐ์์ผ๋ก ์ค์์ดํผ ์ด๋ฏธ์ง height์ ์ง์ ์ ์ธ vh๋ผ๋ ์์น๋ฅผ ์ค์ ๋ด๊ฐ ์ํ๋ ๋ ์ด์์์ผ๋ก ๋์ค์ง ์์๊ฒ