File: /www/wwwroot/www.frtyn.ga/yb/static/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 = "#f2adbb"
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 = "#f2adbb"
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
})
/* list img*/
$('.list_handle').click(() => {
/*当有顶部转换的时候 设置成默认状态*/
// $('.popText').html(` 美胸導師幫你</br>
// 快速解決胸部困擾`)
$(".popWindow").fadeIn();
$(".popWindow").fadeTo("slow", 1).css({
"touch-action": "none"
});
})
$('.pop_close').click(() => {
$('.popWindow').fadeOut().css({
"touch-auto": "auto"
});
})
/**/
/* 顶部转换*/
let contentTop = document.getElementsByClassName("case_border")[0];
let ob2 = new IntersectionObserver(
el => {
if (el[0].isIntersecting) {
console.log(345)
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>
バストアップ法をチェック`)
$(".popWindow").fadeIn();
});
/*顶部转换 end*/
/*监听滚动*/
$(document).ready(function () {
$(window).scroll(function () {
var topp = $(document).scrollTop()
// alert(topp)
if (topp > 358) {
$('.animateImg').css({
'animation': 'shake 2s'
})
$(window).unbind("scroll");
}
})
})
$('.content_btn').click(() => {
/*当有顶部转换的时候 设置成默认状态*/
// $('.popText').html(` 美胸導師幫你</br>
// 快速解決胸部困擾`)
$(".popWindow").fadeIn();
$(".popWindow").fadeTo("slow", 1).css({
"touch-action": "none"
});
})
})()