/*-----------------------------------------------------------*/
/*copyright by 动力无限 www.btoe.cn*/
/*邮箱 btoe@btoe.cn*/
/*合作电话 400-0599-360*/
/*版权所有违者必究*/
/*-----------------------------------------------------------*/
//search
window.onload = function () {
$('.search_s').click(function () {
var keywords = $('#keywords').val();
if (keywords == "") {
alert('关键字不能为空!')
$("#keywords").focus();
return false;
} else {
window.open('search_' + keywords + '.html', '_self')
}
})
}
//荣誉资质
const businesslicense = document.queryselector('.businesslicense');
const businesslicensebox = document.queryselector('.businesslicensebox');
businesslicense.addeventlistener('click', () => {
businesslicensebox.style.display = 'block';
settimeout(() => {
businesslicensebox.style.opacity = '1';
}, 10);
});
const businesslicenseclose = document.queryselector('.businesslicenseclose');
businesslicenseclose.addeventlistener('click', () => {
businesslicensebox.style.opacity = '0';
settimeout(() => {
businesslicensebox.style.display = 'none';
}, 300);
});
var element = document.getelementbyid("businesslicenseimg");
element.style.fill = "#ff0000";
//鼠标跟随样式
$(function () {
var cursor = '
'
$('body').append(cursor)
$(document).on('mousemove', function (e) {
$('.follower').css({
left: e.clientx,
top: e.clienty
});
});
$(document).on("mouseenter", "a", function () {
$('.follower span').css({
'width': '10px',
'height': '10px',
'top': '0px',
'left': '0px',
'transition': '.5s'
})
});
$(document).on("mouseleave", "a", function () {
$('.follower span').css({
'width': '20px',
'height': '20px',
'top': '-10px',
'left': '-10px',
'transition': '.5s'
})
});
if (window.innerwidth < 1200) {
$('#c_public_htmlcode-15542567538626617').hide();
}
})
// end
//笔记本默认放大150% 处理方式
function detectzoom() {
var ratio = 0,
screen = window.screen,
ua = navigator.useragent.tolowercase();
if (window.devicepixelratio !== undefined) {
ratio = window.devicepixelratio;
} else if (~ua.indexof('msie')) {
if (screen.devicexdpi && screen.logicalxdpi) {
ratio = screen.devicexdpi / screen.logicalxdpi;
}
} else if (window.outerwidth !== undefined && window.innerwidth !== undefined) {
ratio = window.outerwidth / window.innerwidth;
}
if (ratio) {
ratio = math.round(ratio * 100);
}
return ratio;
}
function getwindowheight() {
var zoom = document.body.style.zoom;
var height = $(window).height();
if (zoom) {
return height / zoom;
}
return height;
}
function getwindowwidth() {
var zoom = document.body.style.zoom;
var width = $(window).width();
if (zoom) {
return width / zoom;
}
return width;
}
window.onresize = function () {
handlescreen()
}
function handlescreen() {
const m = detectzoom();
//alert(m)
document.body.style.zoom = 100 / number(m);
}
if (detectzoom() == 150) {
document.body.style.zoom = 0.666667;
} else if (detectzoom() == 125) {
document.body.style.zoom = 0.8;
}
$(function () {
$('#xunpantext').hover(function () {
var xunpantext = $(this).data('tiptitle');
$('#xunpantip').css({
top: $(this).outerheight(true) + 10 + 'px'
})
$('#xunpantip').text(xunpantext)
$('#xunpantip').addclass('xunpantextactive')
}, function () {
$('#xunpantip').removeclass('xunpantextactive')
})
})
/* 导航 */
$('.nav_xiala_xx .w1200 li > a').hover(function () {
$(this).next('.nav_erji').stop().slidedown(400);
}, function () {
$(this).next('.nav_erji').stop().slideup(400);
$(this).siblings().stop();
});
$('.nav_xiala_xx .w1200 li').mouseleave(function () {
$(this).children('.nav_erji').slideup(400);
});
$(function () {
var w1 = $(window).width();
var l1 = $(".nav_xiala_xx .nav_erji").eq(0).parent().offset().left;
$(".nav_xiala_xx .nav_erji").eq(0).css('left', -l1);
var l2 = $(".nav_xiala_xx .nav_erji").eq(1).parent().offset().left;
$(".nav_xiala_xx .nav_erji").eq(1).css('left', -l2);
var l3 = $(".nav_xiala_xx .nav_erji").eq(2).parent().offset().left;
$(".nav_xiala_xx .nav_erji").eq(2).css('left', -l3);
$(".nav_xiala_xx .nav_erji").css('width', w1);
event.stoppropagation();
});
$(".nav_xiala_xx .w1200 li").on("mouseover", function () {
settimeout(() => {
$(this).find(".top").stop().css({
"transform": "translatey(0)",
"transition-delay": ".2s"
})
$(this).find(".bottom").stop().css({
"transform": "translatey(0)",
"transition-delay": ".4s"
})
}, 200)
})
$(".nav_xiala_xx .w1200 li").on("mouseleave", function () {
settimeout(() => {
$(this).find(".top").stop().css({
"transform": "translatey(20px)",
"transition-delay": ".2s"
})
$(this).find(".bottom").stop().css({
"transform": "translatey(20px)",
"transition-delay": ".1s"
})
}, 200)
})
$(".pro_l_list li:first").addclass("casehover");
$(".pro_l_box .pro_l_nr").eq(0).show();
$(".pro_l_list li").hover(function () {
$(this).addclass("casehover").siblings().removeclass("casehover");
$(".pro_l_box .pro_l_nr").hide().eq($(this).index()).show();
}, function () {
});
//提交
$(function () {
$('.submit-btn').on('click', function () {
var kcontent = $('.xqcontent').val(); //内容
var kuser = $('.username').val(); //名字
var kphone = $('.usertel').val(); //电话
var kcode = $('.codetext').val().trim();//验证码的input
// var kemail = $('.useremail').val();
var reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
if (kuser == "") {
alert('姓名不能为空!')
$(".username").focus();
return false;
}
if (kphone == "") {
alert('号码不能为空!')
$(".usertel").focus();
return false;
}
if (!reg.test(kphone)) {
alert('号码填写有误!')
$(".usertel").focus();
return false;
}
if (kcontent == "" || kcontent.length < 10) {
alert('留言内容必须大于10字!')
$(".xqcontent").focus();
return false;
}
if (kcode == "") { //验证码的input
alert('验证码不能为空')
$(".codetext").focus();
return false;
}
$.post('/api/message.ashx?action=add', {
"kcontent": '信息:' + kcontent,
"kuser": kuser,
"kphone": kphone,
"kcode": kcode //验证码的程序调用
}, function (res) {
if (res == 1) {
alert("留言提交成功");
$('.xqcontent').val('');
$('.username').val('');
$('.usertel').val('');
$('.codetext').val('');
} else {
alert("留言提交失败")
}
})
})
})
$('.submit-qc').on('click', function () {
$('.xqcontent').val('');
$('.username').val('');
$('.usertel').val('');
$('.codetext').val('');//验证码的input
});
//验证码刷新
$(".imgcode").click(function () { //验证码图片刷新
$(this)[0].src = '/api/message.ashx?action=code&' + math.random()
});
// 搜索
$('.searchico .hide').click(function () {
$(".searchbox").removeclass("searchshow");
$(".searchico").removeclass("top");
});
$('.searchico .show').click(function () {
$(".searchbox").addclass("searchshow");
$(".searchico").addclass("top");
});
$('.searchico .hide').click(function () {
$(".searchbox").removeclass("searchshow");
$(".searchico").removeclass("top");
});
function sethome(obj, vrl) {
try {
obj.style.behavior = 'url(#default#homepage)'; obj.sethomepage(vrl)
} catch (e) {
if (window.netscape) {
try {
netscape.security.privilegemanager.enableprivilege("universalxpconnect")
} catch (e) {
alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。")
}
var prefs = components.classes['@mozilla.org/preferences-service;1'].getservice(components.interfaces.nsiprefbranch);
prefs.setcharpref('browser.startup.homepage', vrl)
} else {
alert("您的浏览器不支持,请按照下面步骤操作:\n1.打开浏览器设置。\n2.点击设置网页。\n3.输入:" + vrl + "点击确定。")
}
}
}
function collect(stitle, surl) {
try {
window.external.addfavorite(surl, stitle)
} catch (e) {
try {
window.sidebar.addpanel(stitle, surl, "")
} catch (e) {
alert("加入收藏失败,请使用ctrl+d进行添加")
}
}
}
function pagescroll() {
//把内容滚动指定的像素数(第一个参数是向右滚动的像素数,第二个参数是向下滚动的像素数)
window.scrollby(0, -100);
//延时递归调用,模拟滚动向上效果
scrolldelay = settimeout('pagescroll()', 100);
//获取scrolltop值,声明了dtd的标准网页取document.documentelement.scrolltop,否则取document.body.scrolltop;因为二者只有一个会生效,另一个就恒为0,所以取和值可以得到网页的真正的scrolltop值
var stop = document.documentelement.scrolltop + document.body.scrolltop;
//判断当页面到达顶部,取消延时代码(否则页面滚动到顶部会无法再向下正常浏览页面)
if (stop == 0) cleartimeout(scrolldelay);
}