var ss = 0;
function setBarStatus() {
var dire = ss - $(document).scrollTop() || 0;
ss = $(document).scrollTop();
if (ss > 60) {
$(".header").addClass("header_white");
} else {
$(".header").removeClass("header_white");
}
};
if (isHome && $(window).width() > 768) {
setBarStatus();
$(window).scroll(function (e) {
setBarStatus();
})
} else {
$(".header").addClass("header_white");
}
var brandTabOffTop = [];
$(window).resize(function () { // 褰損c绔〉闈㈠搴︾缉灏忓埌绉诲姩绔ぇ灏忔椂
brandTabOffTop = [];
if ($(window).width() <= 768) {
$('.nav-section').each(function () {
var that = $(this);
setTimeout(function () {
brandTabOffTop.push(that.offset().top - 60);
}, 100)
})
} else {
$('.nav-section').each(function () {
brandTabOffTop.push($(this).offset().top);
})
}
})
setTimeout(function () {
brandTabOffTop = [];
var modTab;
if ($('.page-tab').length >= 1) {
modTab = $('.page-tab').offset().top - $('.page-tab').height();
}
if ($(window).width() <= 768) {
$('.footer-navbar dt').click(function () {
$(this).toggleClass('open');
$(this).siblings('dd').toggleClass('open');
});
$('.nav-section').each(function () {
var that = $(this);
setTimeout(function () {
brandTabOffTop.push(that.offset().top - 115);
}, 100)
})
} else {
$('.nav-section').each(function () {
brandTabOffTop.push($(this).offset().top - 150);
})
}
$(window).scroll(function (event) {
if ($(document).scrollTop() >= modTab) {
$('.page-tab').addClass('fixed').css('top', $('.header').outerHeight() + 'px');
} else {
$('.page-tab').css('top', $('.header').outerHeight() + 'px').removeClass('fixed');
}
scrollNav($('.nav-section'));
}).trigger('scroll');
$('.page-tab li').on('click', function () {
if(window.location.pathname == '/foundations'){
$index = $(this).index();
var t = brandTabOffTop[$index > 2 ? $index-1 : $index];
$("html,body").animate({ scrollTop: t + "px" }, 200);
}else{
var t = brandTabOffTop[$(this).index()];
$("html,body").animate({ scrollTop: t + "px" }, 200);
}
})
}, 50);
$('#search_icon_btn').click(function (e) {
$('.header-form').addClass('open')
});
$('.header-clear').click(function (e) {
$('.header-form').removeClass('open')
});
function scrollNav(dom) {
var sections = dom;
sections.each(function (index, el) {
var _this = $(this);
var offset = 0;
if ($(window).width() <= 768) {
offset = _this.offset().top - 115;
} else {
offset = _this.offset().top - 150;
}
if (offset <= $(document).scrollTop()) {
console.log(window.location.pathname);
if(window.location.pathname == '/foundations'){
console.log('index',index >= 2 ? index+1 : index)
$('.page-tab li').eq(index >= 2 ? index+1 : index).addClass('active').siblings().removeClass('active');
}else{
$('.page-tab li').eq(index).addClass('active').siblings().removeClass('active');
}
}
})
}
$('.videolist').each(function () { //閬嶅巻瑙嗛鍒楄〃
$(this).click(function () { //杩欎釜瑙嗛琚偣鍑诲悗鎵ц
var video = $(this).data('url');//鑾峰彇瑙嗛璺緞
$('#video_box_model').show();
$('.videos').html("");
document.getElementById('box_video').play();
});
});
function close1() {
document.getElementById('box_video').pause();//鑾峰彇瑙嗛鑺傜偣
$('.videos').empty();
$('#video_box_model').hide();
}
//涓€鑸儏鍐典笅锛岃繖鏍峰氨鍙互鑷姩鎾斁浜嗭紝浣嗘槸涓€浜涘钁﹊Phone鏈轰笉鍙互
//function onCompleteFunction() {
var videoElement = $('.video');
//videoElement.show();
if (videoElement.length > 0) {
videoElement.each(function () {
this.play();
});
//蹇呴』鍦ㄥ井淇eixin JSAPI鐨刉eixinJSBridgeReady鎵嶈兘鐢熸晥
document.addEventListener("WeixinJSBridgeReady", function () {
videoElement.each(function () {
this.play();
});
}, false);
}
//}
window.onload = function(){
scrollNav($('.nav-section'));
}