//手机跳转适配
document.write("");
$(document).ready(function () {
var sjvar = document.getElementById('sjurl');
if(sjvar)
sjvar.href = murl;
kefu();
// jQuery(".gqtab").slide({ titCell: ".dMtab li", delayTime: 0, pnLoop: false, titOnClassName: "select", defaultIndex: 0 }); //供应详细切换
jQuery(".rzbd").slide({ mainCell: ".tempWrap ul", autoPage: true, effect: "left", autoPlay: true, vis: 3 }); //首页银河国际官方网站介绍滚动
checkInputs();
$("img.index-pic2").lazyload();
carouselLoop();
ChangeBg();
altImg();
});
var codeTo = true;
function carouselLoop () { (function ($) {
$.fn.exist = function () {
return this.length;
};
}(jQuery));
$('.demo-carousel').each(function () {
var $this = $(this),
$carouselCon = $this.find('.demo-carousel-innner'),
$carouselPrev = $this.find('.carousel-prev'),
$carouselNext = $this.find('.carousel-next');
var demoCarousel = $carouselCon.swiper({
mode: 'horizontal',
autoplayDisableOnInteraction: true,
createPagination: false,
loop: true,
slidesPerView: 5,
loopedSlides: 4, speed: 300,
autoplay: 1000,
slideActiveClass: 'slide-panel-active',
slideVisibleClass: 'slide-panel-visible',
});
if ($carouselPrev.exist()) {
$carouselPrev.on({
click: function () {
demoCarousel.swipePrev(false);
}, mouseenter: function () {
demoCarousel.stopAutoplay();
}, mouseleave: function () {
demoCarousel.startAutoplay();
}
});
}
if ($carouselNext.exist()) {
$carouselNext.on({
click: function () {
demoCarousel.swipeNext(false);
}, mouseenter: function () {
demoCarousel.stopAutoplay();
}, mouseleave: function () {
demoCarousel.startAutoplay();
}
}); }
});
}
//标示当前菜单背景
function ChangeBg() {
var f=false;
var pathname=window.location.pathname;
var ObjLi = $(".nav_list li ");
var ObjA;
for (var i = 0; i < ObjLi.length; i++) {
ObjA ="/"+ $(ObjLi[i]).children().children("a").attr("href");
if (pathname==ObjA) {
f=true;
ObjLi[i].className = "hover";
} else {
ObjLi[i].className = '';
}
}
if (!f) {
ChangeBg2();
}
}
//标示当前菜单背景
function ChangeBg2() {
var nav = document.getElementById("navNum");
if (nav == null) {
return;
}
var ObjLi = $(".nav_list li ");
var ObjA;
for (var i = 0; i < ObjLi.length; i++) {
ObjA = $(ObjLi[i]).children().children("a").attr("title");
if (nav.value == null||nav.value=="") {
ObjLi[0].className = "hover";
}
if (nav.value == i || nav.value == ObjA) {
ObjLi[i].className = "hover";
} else {
ObjLi[i].className = '';
}
}
}
function AutoResizeImage(maxWidth, maxHeight, objImg) {
var img = new Image();
img.src = objImg.src;
var hRatio;
var wRatio;
var Ratio = 1;
var w = img.width;
var h = img.height;
wRatio = maxWidth / w;
hRatio = maxHeight / h;
if (maxWidth == 0 && maxHeight == 0) {
Ratio = 1;
} else if (maxWidth == 0) { //
if (hRatio < 1)
Ratio = hRatio;
} else if (maxHeight == 0) {
if (wRatio < 1)
Ratio = wRatio;
} else if (wRatio < 1 || hRatio < 1) {
Ratio = (wRatio <= hRatio ? wRatio : hRatio);
}
if (Ratio < 1) {
w = w * Ratio;
h = h * Ratio;
}
objImg.height = h;
objImg.width = w;
}
function checkInputs(){
//联系我们 表单验证
if(document.getElementById("formMessage"))
{
$.formValidator.initConfig({ formID: "formMessage", debug: false, submitOnce: true,
onError: function (msg, obj, errorlist) {
alert(msg);
},
submitAfterAjaxPrompt: '有数据正在异步验证,请稍等...'
});
$("#tTitle").formValidator({ onShow: "请输入联系人", onFocus: "必填项,请输入联系人", onCorrect: "谢谢您的合作" }).inputValidator({ min: 1, empty: { leftEmpty: false, rightEmpty: false, emptyError: "两边不能有空符号" }, onError: "不能为空,请确认" });
$("#tTel").formValidator({ empty: true, onShow: "请输入你的手机或电话,可以为空哦", onFocus: "格式例如:0577-88888888或11位手机号码", onCorrect: "谢谢你的合作", onEmpty: "你真的不想留手机或电话了吗?" }).regexValidator({ regExp: ["tel", "mobile"], dataType: "enum", onError: "你输入的手机或电话格式不正确" });
$("#tEmail").formValidator({ onShow: "请输入邮箱", onFocus: "邮箱6-100个字符,输入正确了才能离开焦点", onCorrect: "恭喜你,你输对了", defaultValue: "" }).inputValidator({ min: 6, max: 100, onError: "你输入的邮箱长度非法,请确认" }).regexValidator({ regExp: "^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", onError: "你输入的邮箱格式不正确" });
$("#verificationCode0").formValidator({ empty: false, onShow: "请输入4位验证码", onFocus: "请输入4位验证码", onCorrect: "格式正确" }).regexValidator({ regExp: "^\\d{4}$", onError: "请输入4位数字" });
$("#verificationCode0").click(function () {
if (codeTo) {
f_refreshtype();
}
});
}
}
//客服显隐
function kefu() {
$("#aFloatTools_Show").click(function () {
$('#divFloatToolsView').animate({ width: 'show', opacity: 'show' }, 100, function () { $('#divFloatToolsView').show(); });
$('#aFloatTools_Show').hide();
$('#aFloatTools_Hide').show();
});
$("#aFloatTools_Hide").click(function () {
$('#divFloatToolsView').animate({ width: 'hide', opacity: 'hide' }, 100, function () { $('#divFloatToolsView').hide(); });
$('#aFloatTools_Show').show();
$('#aFloatTools_Hide').hide();
});
}
function f_refreshtype() {
var Image1 = document.getElementById("IMGCheckCode");
if (Image1 != null) {
Image1.style.display = "inline";
Image1.src = "services.aspx?op=getcodeimg&mf=406" + "&r=" + Math.random();
codeTo = false;
}
}
function clearInput() {
$('#formMessage').clearForm();
$("#tFkContent").val("");
}
//8013 联系我们 提交表单
function ajaxPost406() {
if ($("#tFkContent").val() == "" || $("#tTitle").val() == "" || $("#tTel").val() == "" || $("#tEmail").val() == "" || $("#verificationCode0").val() == "") {
alert("请填写完整信息");
return false;
} else {
var formdata = $("#formMessage input,textarea").fieldSerialize();
$.ajax({
type: "post",
url: "services.aspx?op=sub&mf=406",
data: { datas: formdata },
success: function (data) {
var returnObj = eval("(" + data + ")");
if (returnObj.state == "1") {
clearInput();
}
alert(returnObj.message);
//document.getElementById("img1").style.display = "none";
}, error: function () {
debugger;
}
});
}
}
//图片弹窗
function altImg() {
$(".boxpctxt .thickbox").click(function () {
var g = this.src || false;
var htmls = '
';
$.layer({
type: 1, //0-4的选择,
title: false,
border: [0],
closeBtn: [0, true],
offset: ['', '50%'],
border: [10, 0.3, '#000'],
shadeClose: true,
area: ['auto', 'auto'],
page: {
html: htmls
}
});
});
}
function smtrz(){
var strvar = document.getElementById("b2blm");
if (strvar !=null) {
strvar.href = strvar.href + "&site=" + encodeURIComponent("企业网站");
}
}