๐ ์ด๋ก
- Edit > replace :: ํ๋ฒ์ ๊ธ์จ ๋ณ๊ฒฝ ๊ฐ๋ฅ
- li{$}*7 :: 1~7๊น์ง ์ซ์๊ฐ ์ฐํ li ์์ฑ
- listBox_text1 = document.getElementsByClassName("listBox_text1");
๋ชจ๋ ์์๋ฅผ ๊ฒ์ํ์ฌ ํน์ ํด๋์ค ์ด๋ฆ์ ๊ฐ์ง ์์๋ฅผ ์ฐพ์์ NodeList(์์์ ์ปฌ๋ ์ )์ผ๋ก ๋ฐํํ๋ค. - ์๋ฐ์คํฌ๋ฆฝํธ ๋ฐ๋ณต๋ฌธ/๋ฐฐ์ด
- jQuery , React , NodeJS > ์๋ฐ์คํฌ๋ฆฝํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- jQuery > CDM > jQuery 3.x
- jQuery > $ / jQuery(document).ready
๐์ค์ต
- ํ ์คํธ ๊ฐ ๋ณ๊ฒฝํ๊ธฐ JS - innerHTML
for (let i = 0; i<jusoA.length; i++){
listBox_text0[i].innerHTML = nameA[i];
listBox_text1[i].innerHTML = jusoA[i];
}
- ํ์ด์ง ์ ํ JS (zIndex)
window.onload=function(){
var menu0, menu1;
menu0 = document.querySelector('.persnal');
menu1= document.querySelector('.edu');
wrap0 = document.querySelector('.wrap0');
wrap1 = document.querySelector('.wrap1');
menu0.onclick=function(){ //menu0 ์ ๋๋ ์ ๋
wrap0.style.zIndex = 10;
wrap1.style.zIndex = 0;
}
menu1.onclick=function(){
wrap0.style.zIndex = 0;
wrap1.style.zIndex = 10;
}
}
-ํ์ด์ง ์ ํ JS - display
popMenu0 = document.getElementById('popMenu0');
//popMenu0 = document.querySelector('#popMenu0');
popMenu1 = document.getElementById('popMenu1');
let at0= document.querySelector('.at0');
let at1 = document.querySelector('.at1');
let at0_text= document.querySelector('.at0_text');
let at1_text = document.querySelector('.at1_text');
popMenu0.onclick=function(){
// at0_text.innerHTML = "๋ฌธ์ ํด๊ฒฐ ๋ฅ๋ ฅ ์
๋๋น";
at0.style.display = "block";
at1.style.display = "none";
}
popMenu1.onclick=function(){
// at1_text.innerHTML = "๋คํธ์ํฌ ๋ฅ๋ ฅ์
๋๋~";
at0.style.display = "none";
at1.style.display = "block";
}
- ํ์ด์ง ์ ํ jQuery (hide/show)
$(function(){
$("menuBox div").on("click",function(){
num = $(this).attr("class"); // ํด๋น ํด๋์ค ๊ฐ ๊ฐ์ ธ์ค๊ธฐ
num = num.substring(4,5); //๋ฌธ์์ด ์๋ฅด๊ธฐ (์ธ๋ฑ์ค ๊ฐ๋ง ๊ฐ์ ธ์ค๊ธฐ)
$(".show").hide(); // id show == ์ฐฝ (์ ๋ถ) ์จ๊ธฐ๊ณ
$(".wrap"+num).show(); // ์ด๊ณ ์ถ์ ์ฐฝ๋ง ์ ํํด์ ์ด๊ธฐ
})
- ๊ณตํต ๋ฐฐ์ด
const wrap5_picA = [
"usagi1.jpg",
"usagi2.jpg",
"usagi3.jpg", ........]
const wrap5_pic_textA =[
"์ข๋น ํ๋ฅดํ ๋นคํ ",
"๋นต ์์ ๋นคํ ", ....... ]
- ๊ทธ๋ฆผ ํ๋ฒ์ ๋ฃ๊ธฐ jQuery (๋ฐฐ์ด)
:eq() ๋ฉ์๋ :: ์ ํํ ์์ ์งํฉ์์ ์ง์ ๋ ์ธ๋ฑ์ค์ ํด๋นํ๋ ์์๋ฅผ ์ ํํฉ๋๋ค. ์ด ๋ฉ์๋๋ 0๋ถํฐ ์์ํ๋ ์ธ๋ฑ์ค๋ฅผ ์ฌ์ฉํ๋ฉฐ, ์ ํํ ์์ ์งํฉ์์ ์ง์ ๋ ์ธ๋ฑ์ค์ ํด๋นํ๋ ์์๋ฅผ ๋ฐํํฉ๋๋ค.
for ( i = 0; i < wrap5_picA.length; i++){
$(".wrap5_box div:eq("+i+")").css("background", "url(img/"+ wrap5_picA[i])
.css("backgroundSize","100% 100%");
$(".wrap3_text"+i).html(wrap5_pic_textA[i]);
}
- ํด๋ฆญ ์ ์ฐฝ ์ด๋ฆฌ๋ ๊ธฐ๋ฅ jQuery
$(".wrap5_box div").on("click", function() {
$(".wrap5_tv").show(); // tv ์ฐฝ ๋ณด์ฌ์ฃผ๊ธฐ
no=$(this).index(); //ํด๋ฆญํ div ์ index ๊ฐ ๊ฐ์ ธ์ค๊ธฐ
$(".wrap5_tv_text").html(wrap5_pic_textA[no]); // ํ
์คํธ ๋ฐ์ค์ ๊ธ์จ ๋ฃ๊ธฐ
$("#pic").attr("src","img/" + wrap5_picA[no]); // ๊ทธ๋ฆผ ๋ฐ์ค์ ๊ทธ๋ฆผ ๋ฃ๊ธฐ
})
- ๋ซ๊ธฐ ๋ฒํผ์ผ๋ก ์ฐฝ ๋ซ๊ธฐ jQuery
$(".wrap5_tv_close").on("click", function() {
$(".wrap5_tv").hide(); // tv ์ฐฝ ์จ๊ธฐ๊ธฐ
})
- ๊ณตํต ๋ฐฐ์ด
let no;
const popup_picA=["usagi1.jpg","usagi2.jpg","usagi3.jpg","usagi4.jpg","usagi5.jpg"]
const popup_picB=["usagi1.jpg","usagi2.jpg","usagi3.jpg","usagi4.jpg","usagi5.jpg"]
const topicA = [" <strong style='color:#FC85AE;'> ๋ฌธ์ ํด๊ฒฐ๋ฅ๋ ฅ </strong> ๋งค์ฐ ์ค์ํฉ๋๋ค.",
"๋ฌธ์ <strong style='color:#FC85AE;'> ์์ฃผ 2</strong> ์ค์ํฉ๋๋ค.",
"๋ฌธ์ <strong style='color:#FC85AE;'> ์์ฃผ 3</strong> ์ค์ํฉ๋๋ค."
];
const topicB = ["ํ๋ฅดํ","๋นต","ํ์นํ์ดํน","์งํ์ฒ "]
- ๊ธ์จ๊ฐ ๋ณ๊ฒฝ jQuery
for (let i =0; i < topicA.length; i++){
$(".at"+i+"_text").html(topicA[i]);
}
for (i = 0; i < topicB.length; i++){
$("#text"+i).html(topicB[i]);
}
- ์์ ๋ณ๊ฒฝ jQuery
hover ์ ๋ค๋ฅด๊ฒ ํด๋ฆญ ์ ์์์ด ์ ์ง๋จ (์ด๋ค ๊ฑธ ์ ํํ๋์ง ํ์ธ ๊ฐ๋ฅ)
$("nav div").on("click",function(){
$("nav div").css("background","#fff");
$(this).css("background","#fc85af79");
})
$(".listBox li").on("click",function(){
no=$(this).attr("class"); // ์์ด๋ ์์๋ด์ ์ ์ฅํ๊ธฐ
// this ๋ก ํด์ผ ์ ๋๊ฐ์ผ๋ก ์ค์ ๋
no=no.substring(7,8); // ์์ด๋ ๋ค ์์๋ด๊ธฐ
// alert(no)
$(".popup_pic").attr("src","img/"+ popup_picA[no]);
$(".listBox li").css("background","#fff");
$(this).css("background","#fc85af79");
// $(".sec0 .at .listBox .at0_picBox img")css("backgroundImage","");
})
$(".at2Box li").on("click",function(){
$(".at2Box li").css("background","white");
$(this).css("background","#fc85af79");
})
- ์ด๋ฏธ์ง ๋ฃ๊ธฐ jQuery
num = $(".at2Box li div:first-child img").attr("class");
//num = num.substring(11,12);
//alert(num);
for (j= 0 ; j<popup_picB.length; j++){
$(".listBox_img"+ j).attr("src","img/"+popup_picB[j]);
}
- ํ์ด์ง๋ด์์ ํ์ด์ง ์ฌ๋ ๋ฐฉ๋ฒ (iframe)
<div class="wrap4_left">
<!-- javascript -->
<iframe name="ch" src="" frameborder="0"></iframe>
</div>
<div class="wrap4_right">
<p>
<a href="https://cssgradient.io/" target="ch">
CSS
</a>
</p>
<p>
<a href="info.html" target="ch">INFO</a>
</p>
<p> <a href="info.html" target="ch">INFO</a></p>
<p> <a href="info.html" target="ch">์ ๋ณด๋ ฅ</a></p>
<p> <a href="info.html" target="ch">์ ๋ณด๋ ฅ</a></p>
<p> <a href="info.html" target="ch">์ ๋ณด๋ ฅ</a></p>
<p> <a href="info.html" target="ch">์ ๋ณด๋ ฅ</a></p>
</div>