// JavaScript Document
var subid="" , pageID = "";
$(function(){init();});
function init(){
vw = $(window).width();
init_nav();
switch($("body").attr("id")){
case "home":
home_init();
break;
case "pshow":
/*$.include("/scripts/jquery.qrcode.js");
//$.include("https://platform-api.sharethis.com/js/sharethis.js#property=610902e34e828c001996f582&product=inline-share-buttons");
init_share();*/
break;
}
init_gallery();
//init_scroll();
//$(window).scroll(init_scroll);
init_sharebtn();
$("#mmenu").on("click",function(){
if($(this).hasClass("menuAct")){
$(this).removeClass("menuAct");
}else{
$(this).addClass("menuAct");
}
$(".navcontent").animate({
opacity: "toggle"
}, "fast" );
return false;
});
$("#mask").on("click",function(){
if(vw<901)
$(".navcontent").hide();
hidemask();
});
ccform_submit();
xmenu();
}
function ccform_submit(){
if($("#ccform").size()){
$("#ccform").submit(function(){
var r = true;
$("#ccform").find("[name]").each(function(){
if($(this).attr("alt")!="" &&$(this).attr("alt")!=undefined){
if($(this).val() == ""){
alert($(this).attr("alt"));
$(this).focus();
r = false;
return false;
}
}
});
return r;
});
}
}
function init_search(){
$("#nav,#nav a:not(.searchA)").on("click",function(){
$("#searchDiv").hide();
});
$(".searchA").on("click",function(){
showmask();
var vvw = vw>1300?1300:vw;
var vvh = 270;
$("#searchDiv").css({width:0,height:0,display:"block"});
$("#searchDiv").animate({width: vvw,
height: vvh,
left:("-"+(0.5 * $("#searchDiv").width())/2),
top:("-"+(0.5 * $("#searchDiv").height())/2)}, 300);
return false;
});
}
function init_psFun(){
$(".psfGba").on("click",function(){
window.history.back(-1);
return false;
});
$(".psfOia").on("click",function(){
init_inquiry();
});
$(".psfPa").on("click",function(){
var pw = window.open("","print page");
var title = $(".title").text();
var url = location.href;
var content = $(".pshowCon").html();
var logo = "
";
if($("#pqr").size()<1){
$("
").appendTo("body");
}
$("#pqr").qrcode({
width:90,
height:90,
render: document.createElement('canvas').getContext ? 'canvas' : 'table',
text:url
});
var image = new Image();
image.src = $("#pqr canvas")[0].toDataURL("image/png");
var hstr = "";
pw.document.writeln(hstr+""+title+"
"+content);
pw.document.close();
pw.focus();
pw.print();
});
}
function resetInquireHeight(h){
if(vw>900)
$("#inquiryCon").height(h);
}
function init_inquiry(){
var idtitle = $(".psfOia").attr("alt").split("|");
if($("#inquiryCon").size() == 0){
$("").appendTo("body");
}
showmask();
$("#inquiryCon").fadeIn();
return false;
}
function close_inquiry(){
$("#inquiryCon").fadeOut();
hidemask();
}
function init_share(){
$(".psfSpa").on("click",function(){
showmask();
$("#shareCon").fadeIn();
});
}
function inquiryHide(){
$("#inquiryCon").fadeOut();
$("#mask").fadeOut();
}
function init_product_category(){
$(".bpfBtn,.closePCC").on("click",function(){
$(".productCategoryCon").animate({
height:"toggle"});
return false;
});
}
function pnsimgInit(){
$('#pnsimg ul').cycle({
speed: 900,
manualSpeed: 900,
fx:"fade",
swipe:true,
//prev:'.lefta',
//next:'.righta',
pager:"#pnsimgNum",
slides:"li"
});
}
function init_sharebtn(){
$("#stw").on("click",function(){
var t = document.title;
var url = location.href;
t = encodeURIComponent(t);
url = encodeURIComponent(url);
var ts = "https://twitter.com/intent/tweet?text="+t+"&url="+url+"&related=";
window.open(ts);
return false;
});
$("#sfb").on("click",function(){
var t = document.title;
var url = location.href;
t = encodeURIComponent(t);
url = encodeURIComponent(url);
var ts = "https://www.facebook.com/login.php?next=https://www.facebook.com/sharer.php?s=100&p[title]="+t+"&p[summary]="+t+"&p[url]="+url+"&codestyle=standard&showshares=true#jtss-fb&p[images]&display=popup";
window.open(ts);
return false;
});
$("#sin").on("click",function(){
var t = document.title;
var url = location.href;
t = encodeURIComponent(t);
url = encodeURIComponent(url);
var ts = "https://www.linkedin.com/start/join?session_redirect=http://www.linkedin.com/sharing/share-offsite?mini=true&url="+url+"&title="+t+"&ro=false&summary="+t+"&source=";
window.open(ts);
return false;
});
$("#swb").on("click",function(){
var t = document.title;
var url = location.href;
t = encodeURIComponent(t);
url = encodeURIComponent(url);
var ts = "https://service.weibo.com/share/share.php?url="+url+"&title="+t;
window.open(ts);
return false;
});
$("#swx").on("click",function(){
if($("#wxcon").size() == 0){
var h = $(document).height();
$("Scan this qrcode and share to wechat.
").appendTo("body");
var url = location.href;
$("#qr").qrcode({
width:300,
height:300,
render: document.createElement('canvas').getContext ? 'canvas' : 'table',
text:url
});
}
var top = $(document).scrollTop()+$(window).height()/2-150;
$("#wxqr").css({"top":top+"px"});
$("#wxcon").show();
return false;
});
}
function wxhide(){
$("#wxcon").hide();
}
function init_scroll(){
//alert($.browser.version);
if($(document).width()<901) return;
if($.browser.msie && $.browser.version=="6.0") return;
var h = 49 , h2 = 112;
var o = $("#top");
var o2 = $("#nav");
if($(window).scrollTop()>44){
if(o.height() == h){
return;
}else{
if(o.css("position")!="fixed"){
o.css({"height":h+"px","position":"fixed"});
$("#logo").css({backgroundSize:"auto 30px"});
}
}
}else{
if(o.height() == h2)
return;
else{
o.css({"height":h2+"px","position":"relative"});
$("#logo").css({backgroundSize:"auto auto"});
}
}
//$(".submenu").hide();
}
function xmenu(){
var oBtn = $("#topMenuBtn");
var oBody = $("body");
var oHead = $("#c-header");
var c = true;
var b = true;
var t = null;
var oNav2 = $("#c-header .c-nav2-box");
oBtn.click(function() {
if (c) {
c = false;
if (b) {
b = false;
t = $(window).scrollTop();
oBody.addClass('c-open');
oBody.css("top", -t);
oBtn.siblings("p").text("关闭");
oNav2.show();
oNav2.find(".c-left").stop().delay(100).animate({ "top": 0 }, 500, function() {
c = true;
});
oNav2.find(".c-right").stop().animate({ "top": 0 }, 500);
} else {
b = true;
oBody.removeClass('c-open');
oBody.css("top", "0");
$(window).scrollTop(t);
oBtn.siblings("p").text("");
oNav2.find(".c-left").stop().delay(100).animate({ "top": "100%" }, 500, function() {
oNav2.find(".c-left").css("top", "-100%");
oNav2.hide();
c = true;
});
oNav2.find(".c-right").stop().animate({ "top": "100%" }, 500, function() {
oNav2.find(".c-right").css("top", "-100%");
});
}
}
return false;
});
$(".c-nav2-box .close").on("click",function(){
oBtn.trigger("click");
})
}
function init_gallery(){
var o = $("#klist");
var total = $("img",o).size();
if(total == 0) return "";
$.include("/scripts/lightbox.min.js");
$.include("/css/lightbox.min.css");
var pageRecord = 12;
var str = "";
var id = "gp-";
var i = 0 ,j = 0;
$("img",o).each(function(){
if((i % pageRecord) == 0){
j++;
str += "";
id = id+j;
}
var title = $(this).attr("alt");
var src = $(this).attr("src");
var hsrc = src.replace(/thumbs\//gi,"");
var hsrc = hsrc.replace(".webp",".jpg");
str += "- ";
str += "
";
str += ""+title+"";
str += " ";
if( ((i+1)%pageRecord) ==0){
str += "
";
}
i++;
});
if( ((i+1)%pageRecord) !=0){
str += "";
}
o.html(str);
var ps = "";
for(i=0;i"+(i+1)+"";
}
$("#kpagelist").html(ps);
$("#kpagelist a").click(function(){
var id = $(this).attr("href").replace(/\#/gi,"");
$(".vk_gallery").hide();
$("#vk_gallery_"+id).show();
$("#kpagelist a.act").removeClass("act");
$(this).addClass("act");
window.location.hash = $(this).attr("href");
window.location.replace();
return false;
});
var cpage = window.location.hash;
if(cpage == ""||cpage == "#")
cpage=1;
else
cpage = cpage.replace(/\#/gi,"");
$("#vk_gallery_"+cpage).show();
$("#pl_"+cpage).addClass("act");
}
function adjustImg(){
return;
}
function scrollToPoint(y){
$("html,body").animate({scrollTop:y},300);
}
$(function(){
$(".tabTitle a").click(function(){
$(".tabTitle a.act").removeClass("act");
var cls = $(this).attr("class");
$(".tabTitle ."+cls).addClass("act");
});
});
var lastNav = null;
var smi = null;
var smo = null;
var vw = 0;
function init_nav(){
return;
$("#nav a").on("click",function(){
if(vw<901){
var o = $(this).next("ul");
if(o.size()>0){
if($(this).hasClass("act")){
o.hide();
$(this).removeClass("act");
}else{
o.show();
$(this).addClass("act");
}
return false;
}
}
});
}
function init_pshowImgs(){
if($("#pimgShow #showCon").size()){
var str = "";
var src = "";
var rel = "";
var title = "";
$("#pimgShow #showCon img").each(function(){
src = $(this).attr("src");
rel = $(this).attr("rel");
title = $(this).attr("title")==undefined?"":$(this).attr("title");
if(rel != undefined)
str += "";
else
str += "";
str += "
";
})
$("#pimgShow #showCon").html(str);
}
$("#pimgShow #showCon").on("click",function(){
$("#bigImgMask").fadeIn("fast");
$("#bigImgConTop").show();
})
$("#bigImgMask").on("click",function(){
$("#bigImgMask").fadeOut("fast");
$("#bigImgConTop").fadeOut("fast");
})
}
$(init_pshowImgs);
function autoInitShowBox(){
var o = $(".zsBox");
var w = $(window).width();
var pageNum = (w>700?4:(w>500?3:2))*2;
var totalNum = $(".zsBox li[class!='zsboxli']").size();
if(totalNum == 0) return;
o.cycle('destroy');
var i = 0 ,str = "";
$("li[class!='zsboxli']",o).each(function(){
if((i % pageNum) == 0){
str += "";
}
str += "- "+$(this).html()+"
";
if( ((i+1)%pageNum) ==0){
str += "
";
}
i++;
});
o.html(str);
o.cycle({
swipe:true,
speed: 900,
manualSpeed: 200,
fx:"scrollHorz",
pager:"#zsBoxNum",
prev:'.prev',
next:'.next',
slides:".zsboxli",
autoHeight:"calc",
log:false,
pauseOnHover:true
});
}
function home_init(){
//autoInitShowBox();
$('#simg ul').cycle({
speed: 900,
manualSpeed: 1900,
fx:"fade",
swipe:true,
autoplay:false,
//paused:true,
prev:'#simgPrev',
next:'#simgNext',
pager:"#simgNum",
pauseOnHover:true,
slides:"li"
});
}
function init_case(){
$.include("/css/animate.min.css");
var a,b,c;
a = $(window).height(); //浏览器窗口高度
var group = $("#crDiv");
$(window).scroll(function(){
b = $(this).scrollTop(); //页面滚动的高度
c = group.offset().top; //元素距离文档(document)顶部的高度
if(a+b>c){
$("#cr1").addClass("animate__animated");
$("#cr1").addClass("animate__fadeInDown");
$("#cr2").addClass("animate__animated");
$("#cr2").addClass("animate__fadeInDown");
$("#cr2").addClass("animate__delay-1s");
$("#cr3").addClass("animate__animated");
$("#cr3").addClass("animate__fadeInDown");
$("#cr3").addClass("animate__delay-2s");
$("#cr4").addClass("animate__animated");
$("#cr4").addClass("animate__fadeInDown");
$("#cr4").addClass("animate__delay-3s");
}else{
return;
}
});
}
var isSupportWebp = function () {
try {
return document.createElement('canvas').toDataURL('image/webp', 0.5).indexOf('data:image/webp') === 0;
} catch(err) {
return false;
}
}
function about_init(){
return false;
}
function isNum(num){
return(new RegExp(/^\d+$/).test(num));
}
function tbclose(){
parent.tb_remove();
}
function sc(){
if (document.all){
try{
window.external.addFavorite(window.location.href,document.title);
}catch(e){
alert( "加入收藏失败,请使用Ctrl+D进行添加" );
}
}else if (window.sidebar){
window.sidebar.addPanel(document.title, window.location.href, "");
}else{
alert( "加入收藏失败,请使用Ctrl+D进行添加" );
}
}
function sy(){
if (document.all){
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(window.location.href);
}else if (window.sidebar){
if(window.netscape){
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}catch (e){
alert( "该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',window.location.href);
}else{
alert('您的浏览器不支持自动自动设置首页, 请使用浏览器菜单手动设置!');
}
}
function showmenu(id){
id = "#"+id;
showmask();
var h = $(id).height();
$(id).css({height:"1px"});
$(id).show();
$(id).animate({height:h+"px"});
}
function closemenu(id){
id = "#"+id;
var h = $(id).height();
$(id).animate({height:"1px"},"slow",function(){
$(id).hide();
$(id).css({height:h+"px"});
});
$("#mask").fadeOut(500);
}
function showmask(){
$("#mask").fadeIn();
}
function hidemask(){
var o = Array("#searchDiv",".productCategoryCon","#inquiryCon","#shareCon");
for(var i=0;i';
return b.getElementsByTagName('i').length === 1;
}
$.extend({
includePath: '',
include: function(file) {
var files = typeof file == "string" ? [file]:file;
var ie = false;
if(isIE(6) || isIE(7) || isIE(8)) ie=true;
for (var i = 0; i < files.length; i++) {
var name = files[i].replace(/^\s|\s$/g, "");
var att = name.split('.');
var ext = att[att.length - 1].toLowerCase();
var isCSS = ext == "css";
var tag = isCSS ? "link" : "script";
var attr = isCSS ? " type='text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";
var link = (isCSS ? "href" : "src") + "='" + $.includePath + name + "'";
//if ($(tag + "[" + link + "]").length == 0) document.write("<" + tag + attr + link + ">" + tag + ">");
if(isCSS){
var cssNode = document.createElement('link');
cssNode.rel = 'stylesheet';
cssNode.type = 'text/css';
cssNode.media = 'screen';
cssNode.href = name+'?t='+new Date().getTime();/*附带时间参数,防止缓存*/
if(ie)
document.getElementsByTagName('head')[0].appendChild(cssNode);
else
document.head.appendChild(cssNode);
}else{
var scriptNode = document.createElement('script');
scriptNode.src = name+'?t='+new Date().getTime();/*附带时间参数,防止缓存*/
if(ie)
document.getElementsByTagName('head')[0].appendChild(scriptNode);
else
document.head.appendChild(scriptNode);
}
}
}
});
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
$(function(){
$("#worksType").on("click",function(){
var w = $(window).width();
if($(this).hasClass("act")){
$("#workTypeList").animate({"opacity":0,"bottom":"0px","width":0,"height":0},250,function(){$("#workTypeList").css({"width":"0","height":"0","display":"none"});});
$(this).removeClass("act");
}else{
$("#workTypeList").css({"width":"90%","height":"auto","display":"block"})
$("#workTypeList").animate({"opacity":1,"bottom":"60px"},250);
$(this).addClass("act");
}
});
});