// 閭鎵嬫満姝e垯鍖归厤
let regEmail = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
let regMobphone = /^1\d{10}$/;
let regPhone = /^0\d{2,3}-?\d{7,8}$/;
let regCode = /^\d{6}$/;
// 鐢ㄤ簬鍒ゆ柇璁块棶缃戝潃鐨勬槸绉诲姩绔繕鏄數鑴戠,杩斿洖鍊煎鏋滄槸false鍒欐槸鐢佃剳绔?濡傛灉杩斿洖鏄痶rue鍒欐槸绉诲姩绔
let browserRedirect = function() {
let sUserAgent = navigator.userAgent.toLowerCase();
let bIsIpad = sUserAgent.match(/ipad/i) === "ipad";
let bIsIphoneOs = sUserAgent.match(/iphone os/i) === "iphone os";
let bIsMidp = sUserAgent.match(/midp/i) === "midp";
let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) === "rv:1.2.3.4";
let bIsUc = sUserAgent.match(/ucweb/i) === "ucweb";
let bIsAndroid = sUserAgent.match(/android/i) === "android";
let bIsCE = sUserAgent.match(/windows ce/i) === "windows ce";
let bIsWM = sUserAgent.match(/windows mobile/i) === "windows mobile";
return (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM);
};
//绉诲姩绔《閮ㄦ悳绱㈡澶勭悊
$('#panel-search').on('click', function() {
let search = $('#panel-search-input').val();
let params = {
'search': search,
};
$("#search-not-found").hide();
$.post('/api/', { m: 4, f: 'searchPanel', p: params }, function(d) {
var result = $.parseJSON(d);
if(result.status == 1){
$("#mobile-panel-normal").hide();
$("#mobile-panel-searching").show();
$("#mobile-panel-searching").html(result.html);
$("#panel-search").val(result.search);
}
if(result.status == 2){
$("#search-not-found").show();
$("#mobile-panel-normal").show();
$("#mobile-panel-searching").hide();
$("#search-not-found").html(result.msg);
}
});
});
$("#panel-search-input").click(function (){
$("#search-not-found").hide();
});
//vmvare椤甸潰js
//鍥炲埌椤堕儴
$('.fixed .totop').click(function () {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if(scrollTop>=560){
$('html,body').animate({scrollTop: 0}, 800);
}
});
//鍥哄畾瀵艰埅
var navFixed = function() {
$(window).on("scroll",function(){
var height = $('.pre-header').outerHeight();
var width = $(".pre-header").outerWidth();
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if(scrollTop >= (height+100)) {
$('.vm-nav .container .nav-tabs').css({"position":"fixed","top":"70px"});
if(width > 414){
$('.fixed .wechat-service').animate({
bottom:'200px'
},50);
$('.fixed .phone-service').animate({
bottom:'130px'
},50);
}else{
$('.fixed .wechat-service').animate({
bottom:'150px'
},50);
$('.fixed .phone-service').animate({
bottom:'105px'
},50);
}
$('.fixed .totop').show();
}else {
$('.vm-nav .container .nav-tabs').css({"position":"absolute","top":"-70px"});
if(width > 414){
$('.fixed .wechat-service').animate({
bottom:'130px'
},50);
$('.fixed .phone-service').animate({
bottom:'60px'
},50);
}else{
$('.fixed .wechat-service').animate({
bottom:'105px'
},50);
$('.fixed .phone-service').animate({
bottom:'60px'
},50);
}
$('.fixed .totop').hide();
}
})
//tab鍒囨崲璺冲埌椤堕儴
$('.tab_contrl').click(function () {
var height = $('.vm-banner').outerHeight();
$('body,html').scrollTop(height-110);
});
}
//鍥哄畾瀵艰埅閫昏緫
$(".fixed .totop").hover(function (){
$(".service-info").hide();
$(".wechat-service-info").hide();
$(".phone-service-info").hide();
$(".totop .icon").show();
$(".totop .icon-hover").hide();
})
$(".fixed .totop").mouseenter(function (){
$(".totop .icon").hide();
$(".totop .icon-hover").show();
})
$(".fixed .wechat-service").hover(function (){
$(".service-info").show();
$(".service-info").css("height","230px");
$(".wechat-service-info").show();
$(".phone-service-info").hide();
$(".wechat-service .icon").show();
$(".wechat-service .icon-hover").hide();
})
$(".fixed .wechat-service").mouseenter(function (){
$(".wechat-service .icon").hide();
$(".wechat-service .icon-hover").show();
})
$(".fixed .phone-service").hover(function (){
$(".service-info").show();
$(".service-info").css("height","130px");
$(".phone-service-info").show();
$(".wechat-service-info").hide();
$(".phone-service .icon").show();
$(".phone-service .icon-hover").hide();
})
$(".fixed .phone-service").mouseenter(function (){
$(".phone-service .icon").hide();
$(".phone-service .icon-hover").show();
})
$(".fixed").hover(function (){
$(".service-info").show();
},function (){
$(".service-info").hide();
})
let moreInter, $moreArrow;
jQuery(document).ready(function() {
// 楠岃瘉閭
// 浜岀骇瀵艰埅鍏ㄥ睆
let qcloud = {};
$('[_t_nav]').hover(function() {
let _nav = $(this).attr('_t_nav');
clearTimeout(qcloud[_nav + '_timer']);
qcloud[_nav + '_timer'] = setTimeout(function() {
$('[_t_nav]').each(function() {
$(this)[_nav == $(this).attr('_t_nav') ? 'addClass' : 'removeClass']('active');
});
$('#' + _nav).stop(true, true).show();
}, 150);
}, function() {
let _nav = $(this).attr('_t_nav');
clearTimeout(qcloud[_nav + '_timer']);
qcloud[_nav + '_timer'] = setTimeout(function() {
$('#' + _nav).stop(true, true).hide();
}, 300);
$('[_t_nav]').removeClass('active');
});
// Carousel
$('#myCarousel').carousel({
interval: 3000,
});
// collapse
$('.navAll li .each-event').on('click', function(e) {
if (!$(this).siblings('.navTwo').hasClass('in')) {
$('.navAll li i').removeClass('glyphicon-minus').addClass('glyphicon-plus');
$(this).find('i').removeClass('glyphicon-plus').addClass('glyphicon-minus');
} else {
$(this).find('i').removeClass('glyphicon-minus').addClass('glyphicon-plus');
}
});
// hover div 鏁堟灉
$('.more-sup,.more-service').hover(function(e) {
$(this).addClass('hover-active');
$(this).find('h3').css('color', '#fff');
$(this).find('p').removeClass('display-none');
$(this).find('span').css('color', '#999999').removeClass('display-ellipsis');
$(this).find('.hover-test').css('display', 'none');
}, function(e) {
$(this).removeClass('hover-active');
$(this).find('h3').css('color', '#333333').removeClass('hover-h3');
$(this).find('p').addClass('display-none');
$(this).find('span').css('color', '#666666').addClass('display-ellipsis');
$(this).find('.hover-test').css('display', 'block');
});
// 璋冪敤缃戦〉瀹㈡湇
$('a[name=pre-consultation]').on('click', function() {
if ($('#nb_icon_wrap').length > 0) {
$('#nb_icon_wrap').click();
}
})
// 閭璁㈤槄
$('#bt-subscription').on('click', function() {
let email = $('#subscribe-email').val();
let params = {
'email': email,
'subscription': 1
};
if (regEmail.test(email)) {
$('#submitEmail').removeClass('has-error').addClass('has-success');
$.post('/api/', { m: 4, f: 'emailSubscribe', p: params }, function(d) {
if (d == 1) {
$('#sub-success').show();
$('#submitEmail').removeClass('has-success');
$('#subscribe-email').val('');
}
});
}
});
$('#subscribe-email').bind('input propertychange', function() {
let email = $('#subscribe-email').val();
if (!regEmail.test(email)) {
$('#submitEmail').addClass('has-error');
} else {
$('#submitEmail').removeClass('has-error').addClass('has-success');
}
});
// 灞曠ず瑙嗛
$("[data-show-media]").on("click", function() {
let width = $(this).data('width'),
height = $(this).data('height'),
src = $(this).data('src');
if (!width) width = 1100
if (!height) height = 620
layer.open({
type: 1,
title: false,
area: [width + "px", height + "px"],
shade: 0.8,
closeBtn: 2,
shadeClose: true,
offset: "auto",
content: ''
});
});
// 灞曠ず瑙嗛-绉诲姩绔€傞厤
$("[data-show-media-mobile]").on("click", function() {
let src = $(this).data('src');
layer.open({
type: 1,
title: false,
area: ["90%"],
shade: 0.8,
closeBtn: 2,
shadeClose: true,
offset: "auto",
content: ''
});
});
// 娓愬彉绠ご
$(document).on("mouseenter", ".more-gradient", function() {
$moreArrow = $(this).find("i");
moreGradient();
moreInter = setInterval(function() {
moreGradient();
}, 350)
}).on('mouseleave', '.more-gradient', function() {
clearInterval(moreInter);
});
//椤堕儴瀵艰埅鏍忔柊鏁堟灉澶勭悊
$(".left-item-group li").mouseenter(function (){
var data_id = $(this).attr("data-id");
$(".left-item-group li").removeClass("active");
$(this).addClass("active");
$(".item-display-block").hide();
$(".item-display-block-"+data_id).show();
})
$(".item-link-navigation a").click(function (){
var data_id = $(this).attr("data-id");
$(".virtual-display-block").hide();
$(".virtual-display-block-"+data_id).fadeIn(500);
})
//椤堕儴瀵艰埅鏍忔杩板姩鎬佹晥鏋滃鐞
$(".nav-down .item-display-block .banner-title").mouseenter(function (){
$(".vinchin-icon").hide();
$(".vinchin-icon-hover").show();
$(".vinchin-icon-hover").animate({
width:"45px",
height:"45px" ,
},250);
$(".banner-title a").css("font-size","20px").css("color","#34CBD6")
$(".banner-title a i").css("font-size","20px").css("color","#34CBD6")
$(".banner-title a").animate({
fontSize:"21px"
},250)
$(".banner-title a i").animate({
fontSize:"21px"
},250)
});
$(".nav-down .item-display-block .banner-title").mouseleave(function (){
$(".vinchin-icon").show();
$(".vinchin-icon-hover").hide();
$(".vinchin-icon-hover").animate({
width:"32px",
height:"32px" ,
},250);
$(".banner-title a").css("font-size","18px").css("color","#3D3D3D")
$(".banner-title a i").css("font-size","18px").css("color","#BCBFC0")
$(".banner-title a").animate({
fontSize:"18px"
},250)
$(".banner-title a i").animate({
fontSize:"18px"
},250)
})
});
let moreGradient = function() {
$moreArrow.eq(0).animate({ opacity: 0.2 }, 100);
$moreArrow.eq(1).animate({ opacity: 0.8 }, 100);
$moreArrow.eq(2).animate({ opacity: 0.4 }, 100);
setTimeout(function() {
$moreArrow.eq(0).animate({ opacity: 0.6 }, 100)
$moreArrow.eq(1).animate({ opacity: 0.2 }, 100)
$moreArrow.eq(2).animate({ opacity: 0.8 }, 100)
}, 150)
setTimeout(function() {
$moreArrow.eq(0).animate({ opacity: 1 }, 100)
$moreArrow.eq(1).animate({ opacity: 0.6 }, 100)
$moreArrow.eq(2).animate({ opacity: 0.2 }, 100)
}, 300)
}
let langChange = function(lang) {
location.href = lang === 'cn' ? "/" : "https://www.vinchin.com/" + lang;
}
//瀵艰埅鍥哄畾
$(function() {
let width = $(document).width();
let input_value = $('#download_input').val();
if (width > 1200 && input_value != 'download_input') {
$('.header').css("background-color", "#fff").css("background-image", "none");
$(window).scroll(function() {
if ($(window).scrollTop() > 30) {
if(window.screen.width < 415) {
// $('.header').css("background-image", "linear-gradient(to right,#01132A, #00788C)");
}
$("body").addClass('page-header-fixed');
} else {
$("body").removeClass("page-header-fixed");
if(window.screen.width > 414) {
// $('.header').css("background-color", "unset").css("background-image", "none");
}
}
});
} else {
if(window.screen.width < 415) {
// $('.header').css("background-image", "linear-gradient(to right,#01132A, #00788C)");
}
$(window).scroll(function() {
if ($(window).scrollTop() > 30) {
$("body").addClass('page-header-fixed');
}else{
$("body").removeClass("page-header-fixed");
}
});
}
if(window.screen.width < 415){
// $('.header').css("background-image", "linear-gradient(to right,#01132A, #00788C)");
}
$('.header').mouseover(function() {
// $('.header').css("background-image", "linear-gradient(to right,#01132A, #00788C)");
})
$('.header').mouseout(function() {
// if(window.screen.width > 414) {
// $('.header').css("background-color", "unset").css("background-image", "none");
// }
if ($(document).scrollTop() > 30 || input_value == 'download_input') {
// $('.header').css("background-image", "linear-gradient(to right,#01132A, #00788C)");
}
})
//瑙e喅鍚堜綔浼欎即鐧诲綍鍜岀敵璇穞op-70涔嬪悗绌虹櫧
let input_value_mt = $('#mt-70').val();
if (input_value_mt == 'mt-70') {
$('.footer-div').css("margin-top", "-70px");
}
});