锘縡unction videoTop() {
var topV = ($(window).height() - $(".videoBl_conBlock video").height()) / 2;
console.log(topV)
$(".videoBl_conBlock video,.videoBl_clear").css({ "top": topV })
}
//瑙嗛
function videoFun(node) {
var _node = node ? node : $(".vid_button");
var htmlTe = '
';
$("body").append(htmlTe);
_node.on("click", function () {
var src = $(this).attr("da-src");
if (src != "" && src != undefined) {
$(".vidBl_content").stop(true, true).fadeIn();
$(".videoBl_conBlock").html(Videohtml(src, "100%", "auto"));
var videoNode = document.getElementById("example_video_1")
videoNode.play();
videoNode.oncanplay = function () {
videoTop()
}
}
})
$(window).resize(function () {
videoTop()
})
$(".vidBl_bg,.videoBl_clear").on("click", function () {
$(".vidBl_content").stop(true, true).fadeOut();
$(".videoBl_conBlock").html("");
})
$(".vidBl_content").bind('mousewheel', function (event, delta) {
event.stopPropagation()
return true; // 杩斿洖鍊煎湪杩
});
}
function isTouch() {
if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
return true;
}
return false;
}
$(function () {
var scrTop = 0;
//鍏ㄥ睆鑷€傚簲
var wHeight = $(window).height();
var wWidth = $(window).width();
function resize() {
wHeight = $(window).height();
wWidth = $(window).width();
}
resize();
$(window).resize(function () {
resize();
});
/* 鍓嶇鑷€傚簲鍙屽浘澶勭悊锛岀被鍚嶇粦瀹氾紙img_node缁戝浘锛宐g_node缁戣儗鏅級锛寃-src(瀵瑰簲PC)锛宼-src锛堝搴斿井绔欙級 */
$(".img_node").each(function () {
var _this = $(this);
if (isTouch()) {
_this.attr("src", $(this).attr("t-src"));
} else {
_this.attr("src", $(this).attr("w-src"));
}
})
$(".bg_node").each(function () {
var _this = $(this);
if (isTouch()) {
_this.css("background-image", "url(" + $(this).attr("t-src") + ")");
} else {
_this.css("background-image", "url(" + $(this).attr("w-src") + ")");
}
})
//涓€绾у鑸垵濮嬮€変腑
var href = location.href;
var n = 0;
var news = new RegExp("/news/");
var Recruitment = new RegExp("/Recruitment/");
var Encyclopedia = new RegExp("/Encyclopedia/");
var scientific = new RegExp("/scientific/");
var product = new RegExp("/product/");
var aboutUs = new RegExp("/aboutUs/");
if (news.test(href)) {
n = 5;
} else if (Recruitment.test(href)) {
n = 6;
} else if (Encyclopedia.test(href)) {
n = 4;
} else if (scientific.test(href)) {
n = 3;
} else if (product.test(href)) {
n = 2;
} else if (aboutUs.test(href)) {
n = 1;
}
//瀵艰埅瑙﹀彂
function navFun(m) {
var bWid = $(".nav_ulBl .navitem").eq(m).width();
var leVa = $(".nav_ulBl .navitem").eq(m).position().left;
$(".nav_ulBl .navitem").eq(m).addClass("cur").siblings().removeClass("cur");
$(".nav_bgBl").css({ "width": bWid, "left": leVa });
}
$(".nav_ulBl .navitem").on("mouseover", function () {
var m = $(this).index();
navFun(m);
})
navFun(n);
$(".nav_ulBl").on("mouseleave", function () {
navFun(n);
})
//杩斿洖椤堕儴
$(".fo_top").on("click", function () {
$("html,body").stop().animate({ scrollTop: 0 });
})
//浜岀骇瀵艰埅绱㈠紩鍒濆閫変腑
$(".com_li").eq(0).addClass("cur");
var on = parseInt(location.href.split("on=")[1]) || 0;
if (on > 0) {
$(".com_li").eq(on).addClass("cur").siblings().removeClass("cur");
}
//娓愭粴娓愬嚭 amBl
function animPlay(select) {
$(select).addClass("animNode");
function animFun() {
$(".animNode").each(function () {
var _node = $(this);
var hTop = $("#header").offset().top;
var bTop = _node.offset().top - $(window).height() / 1.5;
if (bTop < hTop) {
_node.addClass("anPlay")
}
})
}
animFun();
$(window).scroll(function () {
animFun();
})
}
animPlay(".amBl");
$(".touc_button,.bgCol_block").on("click", function () {
$(".touc_button").toggleClass("cur");
if ($(".touc_button").hasClass("cur")) {
$("#navWrapper").stop().animate({ right: 0 });
$(".bgCol_block").stop(true, true).fadeIn();
} else {
$("#navWrapper").stop().animate({ right: -196 });
$(".bgCol_block").stop(true, true).fadeOut();
$(".subnav").css({ "display": "none" });
}
})
/* 鍓嶇鑷€傚簲鍙屽浘澶勭悊锛岀被鍚嶇粦瀹氾紙img_node缁戝浘锛宐g_node缁戣儗鏅級锛寃-src(瀵瑰簲PC)锛宼-src锛堝搴斿井绔欙級 */
$(".img_node,.video_node").each(function () {
var _this = $(this);
if ($(window).width() > 768) {
_this.attr("src", $(this).attr("w-src"));
} else {
var src = $(this).attr("t-src") || $(this).attr("w-src");
_this.attr("src", src);
}
})
$(".bg_node").each(function () {
var _this = $(this);
if ($(window).width() > 768) {
_this.css("background-image", "url(" + $(this).attr("w-src") + ")");
} else {
var src = $(this).attr("t-src") || $(this).attr("w-src");
_this.css("background-image", "url(" + src + ")");
}
})
if ($(window).width() < 768) {
$(".navitem>a").each(function () {
if ($(this).siblings(".subnav").length > 0) {
$(this).attr({ "href": "javascript:;" });
}
})
$("#navWrapper .content .nav > .navitem").on("click", function () {
var _th = $(this).find(".subnav");
if (_th.css("display") == "block") {
$(this).find(".subnav").css({ "display": "none" });
} else {
$(this).find(".subnav").css({ "display": "block" });
}
})
} else {
$("#navWrapper .content .nav > .navitem").hover(function () {
$(this).find(".subnav").css({ "display": "block" });
}, function () {
$(this).find(".subnav").css({ "display": "none" });
})
}
})