// (function(doc, win) {
// var docEl = doc.documentElement,
// resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
// recalc = function() {
// var clientWidth = docEl.clientWidth;
// if (!clientWidth) return;
// if (clientWidth >= 1920) {
// docEl.style.fontSize = '100px';
// } else {
// docEl.style.fontSize = 100 * (clientWidth / 1920) + 'px';
// }
// };
// if (!doc.addEventListener) return;
// win.addEventListener(resizeEvt, recalc, false);
// doc.addEventListener('DOMContentLoaded', recalc, false);
// })(document, window);
// 鍔犺浇灞
function layer_loading(msg){
var loading = layer.msg(
msg+'... 璇峰嬁鍒锋柊椤甸潰',
{
icon: 1,
time: 3600000, //1灏忔椂鍚庡悗鑷姩鍏抽棴
shade: [0.2] //0.1閫忔槑搴︾殑鐧借壊鑳屾櫙
});
//loading灞
var index = layer.load(3, {
shade: [0.1,'#fff'] //0.1閫忔槑搴︾殑鐧借壊鑳屾櫙
});
return loading;
}
function ey_fleshVerify(){
var src = __eyou_basefile__ + "?m=api&c=Ajax&a=vertify&type=users_login&r=" + Math.floor(Math.random()*100);
$('form#popup_login_submit #imgVerifys').attr('src', src);
}
// 棣栭〉杞挱
banner1();
function banner1(){
var swiper = new Swiper('.c-banner1', {
speed:1000,
autoplay : {
delay:4000,
disableOnInteraction: false,
},
effect : 'fade',
pagination: {
el: '.c-banner1 .swiper-pagination',
clickable :true,
renderBullet: function (index, className) {
return '
';
},
},
// on:{
// init: function(){
// swiperAnimate(this); //鍒濆鍖栧畬鎴愬紑濮嬪姩鐢
// },
// slideChangeTransitionEnd: function(){
// swiperAnimate(this); //姣忎釜slide鍒囨崲缁撴潫鏃朵篃杩愯褰撳墠slide鍔ㄧ敾
// }
// }
});
}
$(document).ready(function(){
// 椤甸潰婊氬姩闅愯棌瀵艰埅
isScroll();
function isScroll(){
/* var i = $(window).scrollTop();
var obj = $("#c-header");
if($("#c-placeholder").length!=0){
obj.addClass("c-head-hide");
}else{
fn1();
$(window).scroll(function(){
i = $(this).scrollTop();
fn1();
});
}
function fn1(){
if(i>50){
obj.addClass("c-head-hide");
}else{
obj.removeClass("c-head-hide");
}
} */
}
// 瀵艰埅
cNav();
function cNav(){
var oBody = $("body");
var oNav = $("#c-header .c-nav");
var oBtn = $("#c-header .c-switch");
var oL = $("#c-header .c-nav li");
var oA = $("#c-header .c-nav2 a");
var num = 0;
oBtn.click(function(){
oBody.toggleClass('c-open');
});
$(window).resize(function(){
if ($("#c-header .c-nav").css("display") == "block") {
oBody.removeClass("c-open");
}
});
oL.hover(function(){
$(this).children("ul").stop().slideToggle();
},function(){
$(this).children("ul").stop().slideToggle();
});
oA.click(function(){
$(this).next().slideToggle();
});
oL.each(function(){
if($(this).hasClass("active")){
num = $(this).index();
}
$(this).hover(function(){
oL.eq(num).removeClass("active");
},
function(){
oL.eq(num).addClass("active");
});
});
}
// 椤堕儴璇█銆佹悳绱
topMove();
function topMove(){
var oBtn1 = $("#c-header .c-nav .c-language>a");
var oBtn2 = $("#c-header .c-nav .c-search-box>a");
var oList1 = $("#c-header .c-nav .c-language .c-list");
var oList2 = $("#c-header .c-nav .c-search-box form");
var oButton = $("#c-header .c-nav .c-search-box form button");
var submitBoxBtn = $('#submitBoxBtn');
submitBoxBtn.click(function (){
$('.searchBar-m').fadeToggle();
})
oBtn2.click(function(e){
e.stopPropagation();
oList2.stop().fadeToggle();
oList1.stop().fadeOut();
$('.searchBar-m').fadeToggle();
});
oList2.click(function(e){
e.stopPropagation();
});
$("html,body").click(function(){
oList2.stop().fadeOut();
oList1.stop().fadeOut();
});
}
// 榧犳爣绉诲叆瀵艰埅鏁堟灉
headHover();
function headHover(){
var h = $("#c-header");
var aLi = $("#c-header .c-nav li");
var aItem1 = $("#c-header .c-nav li .c-list1 .c-item");
var aItem2 = $("#c-header .c-nav li .c-list2 .c-item");
var num = 0;
aLi.hover(function(){
$(this).find(".c-list-box").css({"display":"block","opacity":"0"});
$(this).find(".c-list-box").stop().animate({"top":"82px","opacity":"1"},500);
},function(){
if($("#c-placeholder").length==0 && $(window).scrollTop()<50){
$(this).find(".c-list-box").stop().animate({"top":"100px","opacity":"0"},500,function(){
$(this).css({"display":"none"});
});
}else{
$(this).find(".c-list-box").stop().animate({"top":"82px","opacity":"0"},500,function(){
$(this).css({"display":"none"});
});
}
});
fn1();
aItem1.hover(function(){
num = $(this).index();
fn1();
});
function fn1(){
aItem1.removeClass("active");
aItem1.eq(num).addClass("active");
aItem2.removeClass("active");
aItem2.eq(num).addClass("active");
}
}
});
$(function() {
// 鎼滅储鎻愪氦
$('#formSubmit').click(function () {
$('#search').submit();
})
// 鐢ㄦ埛鐧婚檰
$('#showlogin').click(function () {
// 鏄剧ず钂欑増
$('.dialog-mask').show();
$('#loginbox').show();
})
$('.dialog-close').click(function () {
$('.dialog-mask').hide();
$('#loginbox').hide();
})
$('#login_submit').click(function () {
var username = $('form#popup_login_submit input[name=username]');
var password = $('form#popup_login_submit input[name=password]');
if($.trim(username.val()) == ''){
layer.msg('鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒', {time: 1500, icon: 5});
username.focus();
return false;
}
if($.trim(password.val()) == ''){
layer.msg('瀵嗙爜涓嶈兘涓虹┖锛?, {time: 1500, icon: 5});
password.focus();
return false;
}
$('form#popup_login_submit input[name=referurl]').val(window.location.href);
var index = layer.load();
$.ajax({
// async:false,
url : __eyou_basefile__ + "?m=user&c=Users&a=login",
data: $('#popup_login_submit').serialize(),
type:'post',
dataType:'json',
success:function(res){
console.log(res)
if (1 == res.code) {
if (5 == res.data.status) {
layer.alert(res.msg, {icon: 5, title: false, closeBtn: false},function(){
window.location.href = res.url;
});
}else{
window.location.href = res.url;
}
} else {
layer.closeAll();
if ('vertify' == res.data.status) {
ey_fleshVerify();
}
if (2 == res.data.status) {
showErrorAlert(res.msg, 4);
} else {
layer.msg(res.msg, {icon: 5,time: 1500});
}
}
},
error:function(e) {
layer.closeAll();
showErrorAlert(e.responseText);
}
});
})
// 澶氫簡涓€灞侭OX 鍗曠嫭鎶界
$("#tabmenu-0 .lk").click(function() {
$(this).addClass("cur").siblings().removeClass("cur");
var index = $(this).parent('.box').children('.lk').index(this);
$('#tabwrap-0').find(".module").eq(index).show().siblings(
'.module').hide();
});
//
$(".tabmenu .lk").click(function() {
$(this).addClass("cur").siblings().removeClass("cur");
var index = $(this).parent('.tabmenu').children('.lk').index(this);
$(this).parents(".tabmenu").siblings(".tabwrap").find(".module").eq(index).show().siblings(
'.module').hide();
});
//椤堕儴鎼滅储
$('.hd-sear .icon').click(function() {
$(this).siblings('.box').addClass('show');
event.stopPropagation();
});
$('body').click(function(event) {
$('.hd-sear .box').removeClass("show");
event.stopPropagation();
});
$('.hd-sear').click(function(event) {
event.stopPropagation();
});
$('.sj-menu').click(function() {
$(this).toggleClass('close');
$('.hd-nav').slideToggle();
});
// if ($(window).width() < 991) {
// $('.hd-nav .arrow').click(function() {
// $(this).toggleClass('this').siblings('.drop').slideToggle();
// $(this).parents('li').toggleClass('cur').siblings('li').removeClass('cur').find('.arrow')
// .removeClass('this').siblings('.drop').slideUp();
// });
// }
// $(".gotop").click(function() {
// $('body,html').animate({
// scrollTop: 0
// }, 500);
// return false;
// });
// $(window).scroll(function() {
// if ($(window).scrollTop() > 1) {
// $(".head").addClass('scroll');
// } else {
// $(".head").removeClass('scroll');
// }
// });
var countCXArr = [];
var countCX = function() {
$('.numscroll').each(function(i, dom) {
if (countCXArr[i] && countCXArr[i] === true) {
return;
}
var sT;
var ncTop;
sT = $(window).scrollTop();
ncTop = $(dom).offset().top;
var id, decimals, startVal, endVal, duration;
if (sT > ncTop - $(window).height() && sT < ncTop) {
$(dom).find('.numCX').each(function() {
id = $(this).attr('id');
decimals = $(this).attr('data-decimals'),
startVal = $(this).attr('data-startVal'),
endVal = $(this).attr('data-endVal'),
duration = $(this).attr('data-speed');
new CountUp(id, startVal, endVal, decimals, duration, {
useEasing: true, //鏁堟灉
separator: '' //鏁板瓧鍒嗛殧绗
})
.start(); // target锛氱洰鏍囧厓绱爄d, startVal锛氫綘鎯宠寮€濮嬬殑鍊? endVal锛氫綘鎯宠鍒拌揪鐨勫€? decimals锛氬皬鏁颁綅鏁帮紝榛樿鍊间负0, duration锛氬姩鐢绘寔缁椂闂翠负绉掞紝榛樿鍊间负2, options锛氶€夐」鐨勫彲閫夊璞
countCXArr[i] = true;
})
}
})
}
countCX();
$(window).on("scroll", function() {
countCX();
})
// 鍏徃绠€浠
profile1();
function profile1(){
var swiper = new Swiper('#c-profile1 .swiper-container', {
direction: 'vertical',
slidesPerView: 'auto',
freeMode: true,
scrollbar: {
el: '#c-profile1 .swiper-scrollbar',
},
mousewheel: true,
});
}
// 浜у搧涓嬫媺鍔ㄧ敾
productSlide();
function productSlide(){
var aLi = $("#c-product4 .c-left-box .c-list li");
aLi.each(function(){
if($(this).hasClass("active")){
$(this).children("ul").stop().slideDown();
}
});
aLi.click(function(e){
e.stopPropagation();
$(this).children("ul").stop().slideToggle();
$(this).toggleClass("active");
})
}
// 10+
// if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) {
// var wow = new WOW({
// boxClass: 'wow',
// animateClass: 'animated',
// offset: 0,
// mobile: true,
// live: true
// });
// wow.init();
// };
});
// document.oncontextmenu = new Function("return false;");
// document.onkeydown = document.onkeyup = document.onkeypress = function(event) {
// var e = event || window.event || arguments.callee.caller.arguments[0];
// if (e && (e.keyCode == 123 || e.keyCode == 116)) {
// e.returnValue = false;
// return (false);
// }
// }