var app={
// 简单的点击实现元素展开和收缩的功能
clickToggle: function(elea,eleb){
$(elea).click(function(){
if(!$(eleb).is(':visible')){
$(this).addClass('clicked');
$(eleb).slideDown();
}else{
$(this).removeClass('clicked');
$(eleb).slideUp();
}
})
},
// 防复制代码
antiClone: function () {
// 防止 Ctrl+C
document.onkeydown = function (e) {
var e = e || event;
if (e.ctrlKey == 1 && e.keyCode == 67) {
return false;
}
};
// 阻止复制
document.body.oncopy = function (){ return false; };
// 禁止选取
document.body.onselectstart=document.body.oncontextmenu=function(){return false;};
},
// 返回顶部
backTop: function(ele,time){
$(ele).click(function () {
$('html, body').animate({
scrollTop:'0'
},time);
})
},
// tab 切换
tabs: function(tabs, tab_box, _event) {
$(tab_box).hide();
$(tab_box).eq(0).show();
$(tabs).eq(0).addClass('on');
$(tabs).bind(_event,function(){
$(this).addClass("on").siblings().removeClass("on");
var _index = $(this).index();
$(tab_box).eq(_index).show().siblings().hide();
})
},
// tab 切换类名
tabsa: function(tabsa, tab_boxa, _eventa) {
$(tab_boxa).eq(0).addClass('a');
$(tabsa).eq(0).addClass('on');
$(tabsa).bind(_eventa,function(){
$(this).addClass("on").siblings().removeClass("on");
var _index = $(this).index();
$(tab_boxa).eq(_index).addClass('a').siblings().removeClass("a");
})
},
// 选中高亮
tabsb: function(tabsb,_eventb) {
$(tabsb).eq(0).addClass('active');
$(tabsb).bind(_eventb,function(){
$(this).addClass("active").siblings().removeClass("active");
})
},
}
$(function () {
index.scrool();
index.click();
index.swiper();
app.clickToggle('.m-bm-navbtn','.m-bm-menu');
app.clickToggle('.sska','.searchbox1');
app.clickToggle('.sska','.sskbj');
app.clickToggle('.search-close-btn','.searchbox1');
app.clickToggle('.search-close-btn','.sskbj');
app.clickToggle('.zywena .rhgxt','.zywena .yy-sec');
app.tabs('.xw-sort1 li','.a4v2c1 .tta','mouseenter');
app.tabsb('.a6b2c1 li','mouseenter');
app.tabs('.sa-a3v2c1d1 li','.sa-a3v2c1d2>li','click');
})
var index = {
// 返回顶部
scrool: function () {
// 鼠标下滑导航添加类名
var $window = $(window);
$window.scroll(function () {
var scrollTop = $(document).scrollTop();
if (scrollTop > 600) {
$(".aat_list li.tops").show();
} else {
$(".aat_list li.tops").hide()
}
if (scrollTop > 0) {
$('.head').addClass("sticky");
} else {
$('.head').removeClass("sticky");
}
});
$('.tops>a').click(function () {
$("html, body").animate({
scrollTop: 0
}, {
duration: 1000,
easing: "swing"
});
});
},
click: function () {
// 锚点
$(".smooth").click(function(){
var href = $(this).attr("href");
var pos = $(href).offset().top;
$("html,body").animate({scrollTop: pos}, 1000);
return false;
});
// 搜索框提示
$(".serbtn").click(function () {
var ttas = $(".sertext").val()
if (ttas == '') {
layer.msg('请输入搜索关键词', function () { time: 2000 });
return false;
}
});
$(".serbtn1a").click(function () {
var ttasa = $(".sertexta").val()
if (ttasa == '') {
layer.msg('请输入搜索关键词', function () { time: 2000 });
return false;
}
});
// 导航下拉
// $('.nav_a1 > li').hover(function(){
// $(this).find('.sec').stop(true).slideToggle(300);
// });
// 头部搜索按钮
$(".ds").click(function () {
$(".search").slideDown();
});
$(".search-con").click(function () {
$(".search").slideUp();
});
$(function () {
$('.msg-tc').on('click', function(){
// $(".pead-cont .tit").text($(this).text());
$(".pead-jsda").show();
});
$('a.jataxta').on('click', function(){
$(".pead-jsda").hide();
});
$(document).click(function(e){
if (!$(".zywena a.rhgxt").is(e.target) && $(".zywena a.rhgxt").has(e.target).length === 0){
$(".yy-sec").slideUp();
}
});
});
// 鎵嬫満绔偣鍑讳笉璺宠浆
$(function () {
if($(window).width()<990){
$('.xw_sort1 li a').removeAttr('href');
}
});
//椋炲叆
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 0,
mobile: true,
live: true
});
wow.init();
new WOW().init();
},
swiper: function (){
var $newsroomSwiper = $('#newsroom-swiper');
var $newsroomList = $('#newsroom-list');
if (!$newsroomSwiper.length || !$newsroomList.length) return;
var dateIcon = 'https://s3.amazonaws.com/mfs.ezvizlife.com/mall/static/20260814/qkhkuv7.svg';
var defaultMediaLogo = 'https://mfs.ezvizlife.com/mall/static/20260817/mwa6pgp.png';
function escapeHtml(value) {
var htmlEntities = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
return String(value == null ? '' : value).replace(/[&<>"']/g, function (character) {
return htmlEntities[character];
});
}
function normalizeUrl(value, fallback) {
var url = String(value || '').trim();
if (/^\/\//.test(url)) return 'https:' + url;
if (/^https?:\/\//i.test(url)) return url;
return fallback || '';
}
function createSwiperItem(item) {
var imageUrl = normalizeUrl(item.image_url);
var newsUrl = normalizeUrl(item.news_url, 'javascript:;');
var mediaLogo = normalizeUrl(item.media_logo || item.logo_url, defaultMediaLogo);
var mediaName = item.media_name || 'EZVIZ';
var readingTime = item.reading_time ? item.reading_time + ' min read' : '';
return '
';
}
function createListItem(item) {
var imageUrl = normalizeUrl(item.image_url);
var newsUrl = normalizeUrl(item.news_url, 'javascript:;');
return '' +
'
' +
'
' + escapeHtml(item.pubdate) + '
' +
'' + escapeHtml(item.news_title) + '
' +
'' +
'';
}
$.ajax({
// url: 'https://testus-mall-ez.ezv-test.com/newsroom/getlist',
// url: 'https://euwww.ezvizlife.com/de/newsroom/getlist',
url: 'https://sgpwww.ezvizlife.com/inter/newsroom/getlist',
type: 'GET',
dataType: 'json',
data: {
page: 1,
type: 'news',
page_size: 6
}
}).done(function (response) {
if (!response || !response.status || !response.data || !$.isArray(response.data.list)) {
if (window.console) console.error('Failed to load newsroom: invalid response.');
return;
}
var newsList = response.data.list.slice(0, 6);
var swiperNews = newsList.slice(0, 3);
var listNews = newsList.slice(3, 6);
$newsroomSwiper.html($.map(swiperNews, createSwiperItem).join(''));
$newsroomList.html($.map(listNews, createListItem).join(''));
if (!swiperNews.length) return;
new Swiper('.mySwiper1a', {
spaceBetween: 30,
loop: swiperNews.length > 1,
autoplay: swiperNews.length > 1,
loopedSlides: swiperNews.length,
direction: 'vertical',
speed: 1000,
pagination: {
el: '.mySwiper1a .swiper-pagination',
clickable: true,
},
});
}).fail(function (xhr, status, error) {
if (window.console) console.error('Failed to load newsroom:', error || status);
});
},
}
if ($('.navItems1').length) {
var heightss = $(".head").height();
var heightss1 = $(".n_mbx1").height();
$(".navItems1").click(function () {
var navto = $(this).attr('navto');
if (navto != "#") {
var $div = $('#' + navto);
var top = $div.offset().top || 0;
$('html,body').animate({
'scroll-top': top - heightss - heightss1
}, 500);
} else {
$('html,body').animate({
'scroll-top': 0
}, 500);
}
});
}
$(function () {
// Lenis 平滑滚动在测试环境平台(ECSTORE)中会与平台的滚动容器冲突,
// 导致 wheel/touch 事件被拦截但无法驱动平台容器,页面完全无法滚动,因此禁用。
// window.lenis = new Lenis({ duration: 1.25, smoothWheel: true });
// if (window.ScrollTrigger && window.gsap) {
// window.lenis.on('scroll', ScrollTrigger.update);
// gsap.ticker.add((time) => { window.lenis.raf(time * 1000); });
// gsap.ticker.lagSmoothing(0);
// } else {
// const scrollFn = (time) => { window.lenis.raf(time); requestAnimationFrame(scrollFn); };
// requestAnimationFrame(scrollFn);
// }
});
if ($.exists('.reveal1') && typeof ScrollTrigger !== 'undefined'){
let revealContainers1 = document.querySelectorAll(".reveal1");
revealContainers1.forEach((container) => {
let image = container.querySelector("img");
let t1 = gsap.timeline({
scrollTrigger: {
trigger: container,
}
});
t1.set(container, { autoAlpha: 1 });
t1.from(container, 1.5, {
opacity: 0,
ease: Power2.out
});
t1.from(image, 1.5, {
scale: 1.3,
delay: -1.5,
ease: Power2.out
});
})
}
if ($('.navItems').length) {
$(".navItems").click(function (e) {
e.preventDefault();
var navto = $(this).attr('navto');
if (navto != "#") {
var $div = $('#' + navto);
if ($div.length > 0) {
var top = $div.offset().top || 0;
$('html,body').animate({
scrollTop: top
}, 500);
}
} else {
$('html,body').animate({
scrollTop: 0
}, 500);
}
});
$(window).scroll(function () {
var scrollTop = $(document).scrollTop();
$('.sa-cont3>div').each(function (index) {
let tops = $('.sa-cont3>div:eq(' + index + ')').offset().top - 500;
if (scrollTop >= tops) {
$('.sa-cont2 .as-za1>li:eq(' + index + ')').addClass('on').siblings().removeClass('on');
}
})
});
}
if ($.exists('.mySwiper1')) {
$(function () {
var solute = new Swiper('.mySwiper1', {
speed: 1000,
spaceBetween: 1,
parallax: true,
loop: true,
loopedSlides: 12,
autoplay: true,
navigation: {
nextEl: '.sa-a3v1-c1 .swiper-button-next1',
prevEl: '.sa-a3v1-c1 .swiper-button-prev1',
},
on: {
slideChangeTransitionStart: function () {
$(".sa-a3v1-d1 li").eq(this.realIndex).addClass("on").siblings().removeClass("on");
}
},
breakpoints:{
768:{
spaceBetween: 10,
}
}
});
$(".sa-a3v1-d1 li").click(function () {
$(this).addClass("on").siblings().removeClass("on");
solute.slideTo($(this).index(), 800, false);
});
});
}
if ($.exists('#certify')) {
certifySwiper = new Swiper('#certify .swiper-container', {
slidesPerView: 3,
// spaceBetween: 30,
// slidesPerView: 'auto',
centeredSlides: true,
loop: true,
loopedSlides: 5,
speed: 800,
autoplay: true,
pagination: {
el: '.swiper-pagination',
clickable :true,
},
breakpoints:{
768:{
slidesPerView: 1,
}
}
// on: {
// progress: function(progress) {
// for (i = 0; i < this.slides.length; i++) {
// var slide = this.slides.eq(i);
// var slideProgress = this.slides[i].progress;
// modify = 1;
// if (Math.abs(slideProgress) > 1) {
// modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
// }
// translate = slideProgress * modify * 260 + 'px';
// scale = 1 - Math.abs(slideProgress) / 5;
// zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
// slide.transform('translateX(' + translate + ') scale(' + scale + ')');
// slide.css('zIndex', zIndex);
// slide.css('opacity', 1);
// if (Math.abs(slideProgress) > 3) {
// slide.css('opacity', 0);
// }
// }
// },
// setTransition: function(transition) {
// for (var i = 0; i < this.slides.length; i++) {
// var slide = this.slides.eq(i)
// slide.transition(transition);
// }
// }
// }
})
}
if ($.exists('.scroll-section') && typeof ScrollTrigger !== 'undefined'){
if($(window).width()>768){
const items = gsap.utils.toArray('.sa-a3v5c1 li');
items.pop();
ScrollTrigger.create({
trigger: '.scroll-section',
start: 'top top',
end: 'bottom top-=300',
// pin: true,
scrub: true,
// markers: true,
animation: gsap.timeline().to(items, {
opacity: 0,
y: '-5%',
scale: 0.9,
stagger: {
each: 0.2,
from: 'start',
}
})
});
}
}
$(function() {
jQuery(".sa-a3v8 .asht1").slide({mainCell:".bd ul",autoPlay:true,effect:"leftMarquee",vis:6,interTime:35,trigger:"click",mouseOverStop:false});
jQuery(".sa-a3v8 .asht2").slide({mainCell:".bd ul",autoPlay:true,effect:"leftMarquee",opp:true,vis:6,interTime:35,trigger:"click",mouseOverStop:false});
})
if ($.exists('.xzmh-conxa')){
$('.xzmh-conxa .carousel').each(function () {
var carousel = this;
var rotateY = 0;
var speed = 0.08;
gsap.set(carousel, {
animation: 'none',
transform: 'translate(-50%, -50%) rotateY(0deg)'
});
window.addEventListener('wheel', function (e) {
var delta = Math.max(Math.min(e.deltaY, 120), -120);
speed += delta * 0.006;
speed = Math.max(Math.min(speed, 4), -4);
}, { passive: true });
gsap.ticker.add(function () {
rotateY += speed;
speed *= 0.96;
if (Math.abs(speed) < 0.08) {
speed = speed < 0 ? -0.08 : 0.08;
}
gsap.set(carousel, {
transform: 'translate(-50%, -50%) rotateY(' + rotateY + 'deg)'
});
});
});
}
// 倒计时
$(function () {
var $days = $('.acta b');
if (!$days.length) return;
var targetDate = new Date(2026, 8, 4);
var now = new Date();
var oneDay = 24 * 60 * 60 * 1000;
var remainingDays = Math.max(0, Math.ceil((targetDate - now) / oneDay));
$days.text(remainingDays);
});
$(function () {
$('.czbof').on('click', function (e) {
e.preventDefault();
var video = document.getElementById('myvideo');
if (!video) return;
video.currentTime = 0;
video.play();
showHeroInfo();
});
});
var heroInfoTimer = null;
function showHeroInfo() {
var $heroInfo = $('.sa-a1v1');
if (!$heroInfo.length) return;
clearTimeout(heroInfoTimer);
$heroInfo.stop(true, true).hide();
heroInfoTimer = setTimeout(function () {
$heroInfo.fadeIn(800);
}, 4000);
}
$(function () {
showHeroInfo();
});
var swiperBanner = new Swiper('.swiper_ast_aft1 .swiper-container', {
slidesPerView: 1, spaceBetween: 10,
pagination: {
el: ".swiper_ast_aft1 .swiper-pagination",
clickable: true,
},
})