텍스트 효과
let txt = $("#section1 .content-item-desc").text();
let split = txt.split("").join("</span><span aira-hidden ='true'>");
split = "<span aira-hidden ='true'>" + split + "</span>";
//한번에
// for(i=1; i<10; i++){
// $("#section"+i+" .content-item-desc").html(split).attr("aria-label", txt);
// }
$(".content-item-desc").each(function(){
let txt = $(this).text();
let split = txt.split("").join("</span><span aria-hidden='true'>")
split = "<span aria-hidden='true'>" + split + "</span>";
$(this).html(split).attr("aria-label",txt);
});
//자바로 한번에
//Parallax Effect
$(window).scroll(function(){
// if( $(window).scrollTop() > $("#section1").offset().top){
// $("#section1 .content-item-desc").addClass("show");
// }else {
// $("#section1 .content-item-desc").removeClass("show");
// }
// $(".content-item").each(function(){
// if( $(window).scrollTop() > $(this).offset().top){
// $(this).find(".content-item-desc").addClass("show");
// }else {
// $(this).find(".content-item-desc").removeClass("show");
// }
// });
if( $(window).scrollTop() > $("#section1").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section1 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section1 .content-item-desc span").eq(index).addClass("show");
},100 * index);
});
}
if( $(window).scrollTop() > $("#section2").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section2 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section2 .content-item-desc span").eq(index).addClass("show");
},10 * index);
});
}
if( $(window).scrollTop() > $("#section3").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section3 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section3 .content-item-desc span").eq(index).addClass("show");
},10 * index);
});
}
if( $(window).scrollTop() > $("#section4").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section4 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section4 .content-item-desc span").eq(index).addClass("show");
},50 * index);
});
}
if( $(window).scrollTop() > $("#section5").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section5 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section5 .content-item-desc span").eq(index).addClass("show");
},10 * index);
});
}
if( $(window).scrollTop() > $("#section6").offset().top){ //화면에 섹션이 보이기 시작할 때
$("#section6 .content-item-desc span").each(function(index){
// console.log(index)
setInterval(function(){
$("#section6 .content-item-desc span").eq(index).addClass("show");
},10 * index);
});
}
});