File: /www/wwwroot/www.baofufacai.com/3/static2/js/index.js
(function () {
/**/
let delayImgs = [...document.getElementsByClassName("delayImg")];
let ob = new IntersectionObserver(el => {
el.forEach(item => {
if (item.isIntersecting) {
if (item.target.hasAttribute("data-src")) {
item.target.src = item.target.dataset.src;
}
ob.unobserve(item.target);
}
});
});
delayImgs.forEach(item => {
ob.observe(item);
});
/**/
let testSwiper = new Swiper('.swiper_container', {
autoHeight: true,
allowTouchMove: false
})
document.querySelectorAll(".swiper_container .swiper-wrapper li").forEach(item => {
item.addEventListener("click", event => {
if(event.target.className == "answer_end") {
event.target.style.backgroundColor = "red"
testSwiper.slideNext();
setTimeout(() => {
testSwiper.slideNext()
}, 1200)
if (event.target.hasAttribute("data-a")) {
document.getElementById(
"num2"
).innerHTML = event.target.getAttribute("data-a");
}
}else{
event.target.style.backgroundColor = "red"
testSwiper.slideNext();
}
});
});
/**/
let scrollBar = new Swiper('.scroll-bar', {
direction: 'vertical',
allowTouchMove: false,
autoplay: {
delay: 500,
stopOnLastSlide: false,
disableOnInteraction: true,
},
speed: 1000,
slidesPerView: 1,
loop: true
})
/**/
$('.animateImg').click(() => {
$(".popWindow").fadeTo("slow", 1).css({"touch-action" : "none"});
})
$('.pop_close').click(() => {
$('.popWindow').fadeOut().css({ "touch-auto": "auto" });
})
/**/
/**/
let contentTop = document.getElementsByClassName("content_top")[0];
let ob2 = new IntersectionObserver(
el => {
if (el[0].isIntersecting) {
document.getElementById("alert").classList.add("act");
ob2.disconnect();
}
},
{ threshold: [0.7] }
);
ob2.observe(contentTop);
document.getElementById("dismiss").addEventListener("click", e => {
document.getElementById("alert").classList.remove("act");
});
document.getElementById("action").addEventListener("click", e => {
document.getElementById("alert").classList.remove("act");
$('.popText').html(`下のボタンをクリックする </br>
彼女たちがいかにダイエットに成功したかをチェックしましょう</br>`)
$(".popWindow").fadeIn();
});
$(".popWindow").on('click', function () {
$(".popWindow").css("display", "none")
})
/**/
$('.content_btn').click(() =>{
$(".popWindow").fadeTo("slow", 1).css({"touch-action" : "none"});
})
})()