์ƒˆ์†Œ์‹

์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด

Code Review

NAVER Careers

  • -

 

 

๐Ÿ‘‰ ์‚ฌ์ดํŠธ๋ช… : ๋„ค์ด๋ฒ„์ปค๋ฆฌ์–ด
๐Ÿ‘‰ ์ž‘์—…๊ธฐ๊ฐ„ : 3์ผ
๐Ÿ‘‰ ์‚ฌ์šฉ์–ธ์–ด : HTML5, CSS3, JQuery
๐Ÿ‘‰ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ : Swiper
๐Ÿ‘‰ ๋ถ„๋ฅ˜ : ๋ฐ˜์‘ํ˜• ์›น์‚ฌ์ดํŠธ
๐Ÿ‘‰ URL : https://codenablog.github.io/Naver-careers/


โœ”๏ธ Medis query ๋ฐ˜์‘ํ˜•
โœ”๏ธ label ์‚ฌ์šฉ๊ณผ custum
โœ”๏ธ swiper ํ™œ์šฉ๊ณผ custum


๊ธฐ์กด NAVER Careers๋Š” 1230px ์ดํ•˜๋กœ ๊ฐ€๋กœ ์Šคํฌ๋กค์ด ์ƒ๊ธฐ๋Š” ํ˜„์ƒ์ด ์žˆ์–ด ์‚ฌ์ด์ฆˆ๋ฅผ ๊ฐœ์„ ํ–ˆ๋‹ค.

์ „์ฒด์ ์œผ๋กœ body์— min-width๊ฐ’์ด ์žˆ์–ด์„œ ๋นผ์ฃผ์—ˆ๊ณ ,  ๋ฉ”์ธ ์„น์…˜ ์˜์ƒ์ด ํ™”๋ฉด์„ ๋ฒ—์–ด๋‚˜ over-flow:hidden;์„ ์ฃผ์–ด ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•ด๊ฒฐํ–ˆ๋‹ค!!

 

๊ฐœ์„  (์ „) : ํ™”๋ฉด ํฌ๊ธฐ๋ณด๋‹ค ํฐ ์ฝ˜ํ…์ธ ๋กœ ๊ฐ€๋กœ์Šคํฌ๋กค์ด ์ƒ๊น€                 ๊ฐœ์„  (ํ›„) : ํ™”๋ฉด ํฌ๊ธฐ์— ์ฝ˜ํ…์ธ ๋ฅผ ๋งž์ถค

 

 

๊ธฐ์กด ์‚ฌ์ดํŠธ ์‚ฌ์ด๋“œ ๋ฉ”๋‰ด๋ฅผ ๋ณด๋ฉด ๋ฉ”์ธ ์Šคํฌ๋กค๊ณผ, ์‚ฌ์ด๋“œ ๋ฉ”๋‰ด์˜ overflowY: scroll;์ด ๋‘˜๋‹ค ๋ณด์ด๋Š” ํ˜„์ƒ์ด ์žˆ์–ด์„œ ์ •์‹ ์ด ์—†๋‹ค. ๐Ÿ˜จ

๋ฉ”๋‰ด ํด๋ฆญ์‹œ body์— overflow : hidden;์„ ์ฃผ์–ด ์‚ฌ์ด๋“œ ๋ฉ”๋‰ด๋ฅผ ๋ณผ๋• ๋ฉ”์ธ ์Šคํฌ๋กค์„ ์—†์•ด๋‹ค.

 

<script> $('.search-area-mo').click(function(){ $('body').addClass('scroll'); }); $('.sc-popup .btn-close').click(function(){ $('body').removeClass('scroll'); }); </script> <style> body.scroll{ overflow-y: hidden; } </style>

 

ss

๊ฐœ์„  (์ „) : ํŒ์—… ์ฐฝ ๋’ค์— ๋ฉ”์ธ์ฝ˜ํ…์ธ ์˜ ์Šคํฌ๋กค์ด ๋‚จ์•„์žˆ์Œ                                    ๊ฐœ์„  (ํ›„) : ์Šคํฌ๋กค ์‚ญ์ œ


 

๋ฏธ๋””์–ด ์ฟผ๋ฆฌ๋Š” ํŠน์ • ์กฐ๊ฑด์ด true์ธ ๊ฒฝ์šฐ์—๋งŒ ์ฝ”๋“œ ๋ธ”๋ก{ } ๋‚ด๋ถ€์˜ CSS ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ด ์ฃผ๋Š” ๊ตฌ๋ฌธ์ด๋‹ค. ๋ฏธ๋””์–ด ์ฟผ๋ฆฌ๋Š” ์ฃผ๋กœ ํฌ๊ฒŒ 3๊ฐ€์ง€ ๊ตฌ๊ฐ„์œผ๋กœ ๋‚˜๋ˆ„๋Š”๋ฐ ๋‚˜๋Š” ์•„๋ž˜์ฒ˜๋Ÿผ ๊ตฌ๊ฐ„์„ ์„ค์ •ํ–ˆ๋‹ค.

@media(max-width:1230px){} //laptop, tablet @media(max-width:1024px){} //tablet @media(max-width:767px){} //mbile

 

TIP) ๋ฐ˜์‘ํ˜• ํŽ˜์ด์ง€๋ฅผ ์ž‘์„ฑ ํ• ๋•Œ ์ตœ์†Œ ๋ทฐ๋ฅผ ๊ธฐ์ค€์„ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.

๋งŒ์•ฝ ๋ชจ๋ฐ”์ผ์„ ์ž‘์„ฑํ•˜๋‹ค๊ณ  ํ•˜๋ฉด, ๋ชจ๋ฐ”์ผ ํ™”๋ฉด ํฌ๊ธฐ๋Š” 320px  ~ 767px์ด๊ธฐ ๋•Œ๋ฌธ์— ์ตœ์†Œ์‚ฌ์ด์ฆˆ๋ฅผ ๊ณ ๋ คํ•ด์„œ 320pxํ™”๋ฉด์„ ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑํ•˜๋ฉด ๋œ๋‹ค. ํ…Œ๋ธ”๋ฆฟ๋„ 768px ~ 1024px์ด๊ธฐ ๋•Œ๋ฌธ์— 768px์„ ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑ.

TIP) ๋ถ„๊ธฐ๋ณ„๋กœ ๋””์ž์ธ์ด ์™„์ „ํžˆ ๋ฐ”๋€๋‹ค๋ฉด max- ์™€  min- ๋™์‹œ์‚ฌ์šฉ, ๋น„์Šทํ•˜๊ฒŒ ์ผ๋ถ€๋งŒ ๋ฐ”๋€๋‹ค๋ฉด ๋‘˜ ์ค‘ ํ•˜๋‚˜ ์„ ํƒ์‚ฌ์šฉ.

 


swiper๋Š” ์ปค์Šคํ…€ํ•˜๋Š” ๋ง›์ด ์žˆ๋‹ค.๐Ÿ˜˜ swiper-button-disabled์ด๋ผ๋Š” ํด๋ž˜์Šค๊ฐ€ ์žˆ๋Š”๋ฐ ์ฒ˜์Œ๊ณผ ๋งˆ์ง€๋ง‰ button์„ ์„ ํƒํ•˜๋Š” class๋ช…์ด๋‹ค.

๊ทธ๋ž˜์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ปจํ…์ธ ๋ฅผ ๋„˜๊ธฐ๋‹ค๊ฐ€ ๋‹ค์Œ ์ปจํ…์ธ ๊ฐ€ ์—†์œผ๋ฉด ๋ฒ„ํŠผ์ด ๋น„ํ™œ์„ฑํ™”๊ฐ€ ๋œ๊ฒƒ ์ฒ˜๋Ÿผ opacity:0.5;์„ ์ฃผ์–ด ์‚ฌ์šฉ์ž์—๊ฒŒ ์‹œ์ž‘์ ์œผ๋กœ ๋งˆ์ง€๋ง‰ ํŽ˜์ด์ง€๋ผ๋Š” ๊ฒƒ์„ ์•Œ๋ ค์ฃผ์—ˆ๋‹ค. ์ข€ ๋” ๋ณด๊ธฐ ํŽธํ•ด์ง„๊ฑฐ ๊ฐ™๋‹ค!

 

 

๋ฐ˜๋Œ€๋กœ swiper-slide-active ํ˜„์žฌ ๋ณด์ด๋Š” slide์˜ class๋ช…๋„ ์žˆ๋‹ค. ๋ฉ”์ธ ๋™์˜์ƒ์ด ์Šค์™€์ดํผ ํ• ๋•Œ ํ˜„์ œ ์Šฌ๋ผ์ดํŠธ๋Š” ํ…์ŠคํŠธ๊ฐ€ opacity:0 ์—์„œ 1๋กœ ๋ฐ”๋€Œ๊ฒŒ ํ•˜์˜€๋‹ค.

 

 

const benefitsSlide = new Swiper(".benefits-slide", { slidesPerView: 1, // ํ™”๋ฉด์˜ ๋„“์ด๊ฐ€ 768px ์ดํ•˜์ผ๋•Œ spaceBetween: 30, navigation: { nextEl: ".btn.next", prevEl: ".btn.prev", }, breakpoints: { 768: { slidesPerView: 2, spaceBetween: 30, }, // ํ™”๋ฉด์˜ ๋„“์ด๊ฐ€ 768px ์ด์ƒ์ผ ๋•Œ 1024: { slidesPerView: 3, spaceBetween: 30, }, // ํ™”๋ฉด์˜ ๋„“์ด๊ฐ€ 1024px ์ด์ƒ์ผ ๋•Œ }, });
 
 

 


์ œ๊ณต๋˜๋Š” ์ด๋ฏธ์ง€์˜ ์‚ฌ์ด์ฆˆ๊ฐ€ ๋‹ค๋ฅธ ์ƒํƒœ์—์„œ  ํ†ต์ผ์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•!

์‚ฌ์ด์ฆˆ๋ฅผ ํ†ต์ผ ์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์—๋Š” ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์žˆ์ง€๋งŒ, ์ด๋ฒˆ์—” ํ‰์†Œ์— ์•ˆ์“ฐ๋Š” ์‚ฌ์šฉํ•ด ๋ณด์•˜๋‹ค!

์›๋ž˜๋Š” img๋ฅผ ๊ฐ์‹ธ๋Š” ํƒœ๊ทธ์— ์›ํ•˜๋Š” ๋†’์ด, ๋„“์ด ๊ฐ’์„ ์ฃผ๊ณ  img์—๋Š” wudth:100%, height:100%, object-fit:cover์„ ์ฃผ์–ด ๊ฐ„๋‹จํžˆ ๋๋‚ด์ง€๋งŒ ์ด๋ฒˆ์—” img๋ฅผ ๊ฐ์‹ธ๋Š” ํƒœ๊ทธ์— padding์„ ์‚ฌ์šฉํ•ด ์‚ฌ์ด์ฆˆ๋ฅผ ์ฃผ์—ˆ๋‹ค.

1. ์ด๋ฏธ์ง€๋“ค์˜ width๊ฐ€ ๊ฐ™์„ ๋•Œ pabbing-bottom์— ์›ํ•˜๋Š” height๊ฐ’์„ ์ค€๋‹ค.

.sc-people .people-slide .swiper-slide .img-area{ padding-bottom: 47.403%; // ์ด ๊ฐ’์ด height๊ฐ’์ด ๋œ๋‹ค. position: relative; }

 

2. pabbing ํฌ๊ธฐ๊ฐ€ ์›ํ•˜๋Š” ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ ๊ฐ’์ด ๋˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

3. ์ดํ›„์— ์ด๋ฏธ์ง€๋ฅผ positon:apsolute๋ฅผ ์‚ฌ์šฉํ•ด์„œ  padding ์œ„์— ์˜ฌ๋ ค๋†“์œผ๋ฉด ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ํ†ต์ผ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

.sc-people .people-slide .swiper-slide img{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

 

 


 

 ๐Ÿ”Ž๊ธฐ๋ณธ HTML

<div class="group-filter"> <ul class="filter-list"> <span class="title">์ง๊ตฐ/์ง๋ฌด</span> <li class="filter-item"> <button class="title">Tech</button> <ul class="sub-list1"> <li class="sub-item check"> <input type="checkbox" id="TechAll"><label for="TechAll" class="all-ch">์ „์ฒด</label> </li> <li class="sub-item"> <button type="button" class="title">Software Development</button> <ul class="sub-list2"> <li class="sub-item2 check"> <input type="checkbox" id="Frontend"><label for="Frontend">Frontend</label> <input type="checkbox" id="Android"><label for="Android">Android</label> <input type="checkbox" id="iOS"><label for="iOS">iOS</label> <input type="checkbox" id="AIML"><label for="AIML">AI/ML</label> <input type="checkbox" id="DataEngineering"><label for="DataEngineering">Data Engineering</label> <input type="checkbox" id="EmbeddedSW"><label for="EmbeddedSW">Embedded SW</label> <input type="checkbox" id="Graphics"><label for="Graphics">Graphics</label> </li> </ul> </li> </ul> </li> </ul> </div> <button class="btn-clear" type="button" aria-label="์ดˆ๊ธฐํ™”">Clear filters</button> <button class="btn-close" type="button" aria-label="๋‹ซ๊ธฐ"></button>

 

๐Ÿ”Ž์ฝ”๋“œ๋ถ„์„ css

.check label::before{ content: ''; position: absolute; left: 0; display: inline-block; width: 10px; height: 10px; border: 1px solid #d0d0d0; border-radius: 50%; margin-top: 8px; } .check input{ position: absolute; clip: rect(0,0,0,0); } .check input:checked+label::before{ background: #000; }

 

๐Ÿ”Ž์ฝ”๋“œ๋ถ„์„ script

$('.all-ch').click(function(){ if ($(this).siblings('input').prop('checked')) { $(this).parent().siblings().find('input').prop('checked',false); } else { $(this).parent().siblings().find('input').prop('checked',true); } $(this).find('input').prop('checked',true); }); $('.btn-clear').click(function(){ $('.group-filter input').prop('checked',false); });

 

 

 

 

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.