jQuery(document).ready(function($) {
// $(document).off('click.bs.dropdown.data-api');
// 返回顶部
$(".gotop").click(function() {
$('body,html').animate({ scrollTop: 0 }, 500);
return false;
});
// 返回顶部显示隐藏
$(window).scroll(function() {
var moveTop = $(window).scrollTop();
if (moveTop > 100) {
$(".gotop").fadeIn();
} else {
$(".gotop").fadeOut(500);
}
});
// 判断设备
function isMobile() {
var userAgentInfo = navigator.userAgent;
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var mobile_flag = false;
//根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
}
}
var screen_width = window.screen.width;
var screen_height = window.screen.height;
//根据屏幕分辨率判断是否是手机
if (screen_width > 325 && screen_height < 750) {
mobile_flag = true;
}
return mobile_flag;
}
// 客服模块
$(".btn-max2").hide();
$(".cls").click(function() {
$(this).parent(".csm-x").removeClass("in");
$(".csm").show();
})
$(".showkf").click(function() {
if (isMobile()) {
// 底部显示联系模块
$(this).siblings(".csm-x").addClass("in");
$(this).hide();
}else{
var storage = window.localStorage;
var key = "id";
var value = storage.getItem(key);
if (value != null) {
value = JSON.parse(value);
}
$('#content').attr('src', "https://zxkfzf.lakala.com/webimwx/menuNavigate/selectNavigate?id=" + value + "&name=" + 'lkl' + +value + "&channelId=162");
$(".custser").css("display", "block");
$('.minwindow').hide();
$(this).hide();
$(".cms-x").hide();
}
});
// 底部客服按钮点击
$(".showkfbtn").click(function(){
var storage = window.localStorage;
var key = "id";
var value = storage.getItem(key);
if (value != null) {
value = JSON.parse(value);
}
$('#content').attr('src', "https://zxkfzf.lakala.com/webimwx/menuNavigate/selectNavigate?id=" + value + "&name=" + 'lkl' + +value + "&channelId=162");
$(".custser").css("display", "block");
$('.minwindow').hide();
})
$(".btn-close").click(function() {
$(".custser").hide();
$(".csm").show();
});
$(".btn-max").click(function() {
$(".winbody").css("height", "650px");
$(".btn-max2").show().siblings(".btn-max").hide();
});
$(".btn-max2").click(function() {
$(".winbody").css("height", "465px");
$(".btn-max").show().siblings(".btn-max2").hide();
});
$(".btn-min").click(function() {
$(".custser").hide();
$('.minwindow').show();
});
$(".minwindow").click(function() {
$(".custser").show();
$('.minwindow').hide();
});
// 视频通用模块 - pc
$(".play-v-btn").click(function() {
$(".pcvideo-x").fadeIn(300);
$(".pcvideo-x video").attr("src", $(this).data('v-src'));
$(".pcvideo-x video")[0].play();
$("body").css('overflow', 'hidden');
$(".pcvideo-x").addClass('vd-x-show');
});
$(".pcvideo-x-close").click(function() {
$(".pcvideo-x").fadeOut(300);
$(".pcvideo-x video")[0].pause();
$("body").css('overflow', 'scroll');
$(".pcvideo-x").removeClass('vd-x-show');
});
// 图片资料通用模块 - pc
$(".show-v-btn").click(function() {
$(".pcimg-x").fadeIn(300);
$(".pcimg-x img").attr("src", $(this).data('v-src'));
$("body").css('overflow', 'hidden');
$(".pcimg-x").addClass('vd-x-show');
});
$(".pcimg-x-close").click(function() {
$(".pcimg-x").fadeOut(300);
$("body").css('overflow', 'scroll');
$(".pcimg-x").removeClass('vd-x-show');
});
// 首页公告弹出层-禁止屏幕滚动-关闭事件-获取图片宽度赋给modal-dialog
function getImgInfo(url, callback) {
var img = new Image();
img.src = url;
if (img.complete) {
callback(img.width, img.height);
} else {
img.onload = function() {
callback(img.width, img.height);
}
}
}
$(function() {
var ai = $(".alert-x-a img").attr("src");
getImgInfo(ai, function(w, h) {
// console.log(w, h);
$(".modal-slg").width(w);
if (w > 1200) {
$(".modal-slg").width(1200); // 图片太大超过1200px 盒子最大
} else {
$(".modal-slg").width(w); // 图片小于1200px 盒子自适应
}
});
});
// 授权体验中心城市showmore
$(".showmorecity img").click(function() {
$(".showmorecity").toggleClass('open');
$(".aec-page-city").toggleClass('open');
});
// 授权体验中心 tab
$(".aec-page-city-name").click(function(e) {
var apcnnum = $(this).index();
$(".aec-page-city-name").eq(apcnnum).addClass('active').siblings('.aec-page-city-name').removeClass('active');
$(".aec-page-list-shop").eq(apcnnum).addClass('active').siblings('.aec-page-list-shop').removeClass('active');
});
// resize
// var x=0;
// $(window).resize(function(event) {
// /* Act on the event */
// var res;
// var widthwin = $(window).width();
// var whb = 890/1900;
// if (res){clearTimeout(res)}
// res = setTimeout(function(){
// // console.log(x+=1);
// $(".banner-index-item").height(widthwin*whb);
// $(".saas-item").height(widthwin*999/1900);
// $(".wcanpay-item").height(widthwin*994/1900);
// // $(".tools-slide").css("width","80%");
// // console.log(widthwin);
// },200);
// });
// 关于我们简介 处理换行符
// var str = String($(".aboutlkl-x-intro").html());
// str = str.replace(/(\r\n)|(\\n)|(\\r)/g,'
');
// console.log(str);
// $(".aboutlkl-x-intro").html(str);
// 移动端设置
// 移动端底部导航-公共js-无需判断分辨率
$(".footer-nav div.list-group").on("click", function() {
var dnum = $(this).index();
// console.log(dnum);
$(".footer-nav div.list-group").eq(dnum).toggleClass("open").siblings("div").removeClass('open');
});
// 删除banner文案换行符 - 分辨率判断
if ($(window).width() <= 768) {
$('.bii-title').find('br').remove();
$('.o2o-right-intro').find('br').remove();
// $('.pmi-intro').find('br').remove();
$('.tbo-item-intro').find('br').remove(); // 产品与服务-电商运营
// $(".banner-solution-4 .bli-title br").remove(); //解决方案-新零售
// $(".banner-solution-3 .bli-title br").remove(); //解决方案-跨境电商
// $(".banner-solution-2 .bli-title br").remove(); //解决方案-店面经营
// $(".banner-solution-1 .bli-title br").remove(); //解决方案-中小微商户
var blihtml = $(".banner-solution .bli-title").html();
if (blihtml) {
blihtml = blihtml.replace(/\n|\r|
/g, "");
$(".banner-solution .bli-title").html(blihtml);
}
// $(".banner-solution-4 .bli-title").html($(".banner-solution-4 .bli-title").html().replace(/\n|\r|
/g, ""));
// $(".banner-solution-3 .bli-title").html($(".banner-solution-3 .bli-title").html().replace(/\n|\r|
/g, ""));
// $(".banner-solution-2 .bli-title").html($(".banner-solution-2 .bli-title").html().replace(/\n|\r|
/g, ""));
// $(".banner-solution-1 .bli-title").html($(".banner-solution-1 .bli-title").html().replace(/\n|\r|
/g, ""));
//移动端导航下拉
$(".navbar-nav li").removeClass('open');
$(".navbar-nav .dropdown").click(function(event) {
$(this).addClass('opening').siblings('.dropdown').removeClass('opening');
});
$('.navbar-nav').on('shown.bs.dropdown', function() {
$(".navbar-nav li").removeClass('open');
});
} else {
//pc导航鼠标移入下拉
$(".navbar-nav .dropdown").mouseover(function() {
$(this).addClass("open");
$(".navbar-nav .dropdown.active").removeClass("open");
$(".navbar").css('min-height', '160px');
$(".banner-mer-last").css('top', '160px');
});
$(".navbar-nav .dropdown").mouseleave(function() {
$(this).removeClass("open");
$(".navbar-nav .dropdown.active").addClass("open");
$(".navbar").css('min-height', '128px');
$(".banner-mer-last").css('top', '128px');
});
$(".navbar-nav .dropdown.active").mouseover(function() { $(this).addClass("open").siblings('.dropdown').removeClass("open"); });
// pc端电商运营标题 删除最后一个换行符
// $(".tbo-title br").eq(1).remove();
// $(".tbo-title2 br").eq(1).remove();
$(".tbo-ad-info br").eq(1).remove(); //解决方案-店面经营
// $(".banner-solution-2 .bli-title br").eq(1).remove(); //解决方案-店面经营
$(".banner-solution-3 .bli-title br").eq(1).remove(); //解决方案-跨境支付
$(".tbo-item-title br").remove();
$(".o2o-right-title br").remove(); // pc 首页 线上线下一体
$(".mpm-item-title br").remove(); // 产品与服务-营销推广
// pc端导航 body点击不回收
$("body").on('click', function(e) {
e.stopPropagation();
});
// 页面底部 支付业务许可证弹出层
$(".zfc").click(function() {
$('#zfc').modal('show');
});
// pc导航 除首页高度弹开
var isecp1 = $(".navbar-nav li").eq(0).hasClass('active');
if (!isecp1) {
$(".navbar").css('min-height', '160px');
$(".navbar-nav .dropdown").mouseleave(function() { $(".navbar").css('min-height', '160px'); });
}
}
});