$(function() {
function mySubString(cur_object) {
var cur_line = Math.floor(
$(cur_object).height() / parseInt($(cur_object).css("lineHeight"))
);
var line_size = Math.floor(
$(cur_object).width() / parseInt($(cur_object).css("fontSize"))
);
$(cur_object).text(
$(cur_object)
.text()
.slice(0, cur_line * line_size) + "..."
);
}
$(".header .phone span").mousemove(function() {
$(".search").slideDown();
});
$(".search").mouseleave(function(event) {
$(".search").slideUp();
});
// 数字自动增长
if ($(".counter").length) {
var counter = $(".counter");
counter.waypoint(
function(direction) {
if (direction == "down") {
counter.countTo();
}
}, {
offset: "64%",
}
);
}
// 首页新闻点击切换
$(".index-news .nav a").toggleOn($(".index-news .item"));
// 产品列表页导航切换
$(".product .nav .title").click(function(event) {
if (!$(this).parent().hasClass("active")) {
$(this).parent().addClass("active").siblings().removeClass("active");
} else {
$(this).parent().removeClass("active");
}
});
// 服务问答点击切换
$(".ser-qa li h4").click(function(event) {
$(this).parent().toggleOn();
});
// 产品详情页内容切换
$(".pro-detail .content .title h6").toggleOn($(".pro-detail .content .txt"));
// 服务问答点击加载更多
// $(".news-cona .con ul").getMore($(".jzgd-btna .more"), 6, 6);
// $(".tjsp-cona .conb ul").getMore($(".jzgd-btnb .more"), 6, 6);
// 研发流程点击切换
$(".res-process .nav h4").toggleOn($(".res-process .item"));
// 首页产品切换
$(".index-product .nav a").hover(function() {
$(this).addClass("active").siblings().removeClass("active");
if ($(this).index() >= 3) return;
$(".index-product .content")
.removeClass("active")
.eq($(this).index())
.addClass("active");
});
// 鼠标hover效果
$("").addClass("hover-img-big");
$(
".index-about .com-title a, .index-power .com-title a, .index-news li a,.product .subnav a"
).addClass("hover-left-move");
$(
".index-product .swiper-container li,.index-news .more,.pro-detail .related li"
).addClass("hover-top-move");
$(".page-nav a").addClass("com-hover-ba");
// 点击播放视频
$(".video-btnb").click(function() {
var vlink = $(this).data("link");
layer.open({
type: 2,
title: false,
area: ["800px", "600px"],
shade: 0.8,
closeBtn: 0,
shadeClose: true,
content: vlink,
});
});
$(".vc-in-link").click(function() {
var url = $(this).data("url");
var innerVideo =
"";
$(".tc-message2").html(innerVideo);
$(".vwrap2").show();
});
// $(".vc-in-link").click(function() {
// var url = $(this).data("url");
// var source =
// '';
// $(".tc-message2").html(source);
// $(".vwrap2").show();
// $("#videobox2 video")[0].play();
// });
// $(".vwrap2 .videobtg2, .vwrap2 .close2").click(function() {
// $(".vwrap2").hide();
// $("#videobox2 video")[0].pause();
// });
$(".vwrap2 .videobtg2, .vwrap2 .close2").click(function() {
$(".vwrap2").hide();
});
// 相册
$(".imgs-btn").click(function() {
layer.photos({
photos: $(this).parent().get(0),
anim: 5,
});
});
if ($(".g-detail .detail .nav").length) {
var old_top = $(".g-detail .detail .nav").offset().top;
}
// 页面滚动事件
$(window).scroll(function() {
if ($(window).scrollTop() > $(".header").height()) {
$(".header").addClass("top");
} else {
$(".header").removeClass("top");
}
if ($(window).scrollTop() > $(".banner").height()) {
$(".page-nav").addClass("top");
} else {
$(".page-nav").removeClass("top");
}
if ($(window).scrollTop() > old_top - 80) {
$(".g-detail .detail .nav").addClass("top");
} else {
$(".g-detail .detail .nav").removeClass("top");
}
if ($(window).scrollTop() > 500) {
$(".go-top").fadeIn(500);
} else {
$(".go-top").fadeOut(500);
}
$(".com-scroll").each(function() {
if ($(window).scrollTop() > $(this).offset().top - 200) {
$("..g-detail .detail .nav a")
.eq($(this).index())
.addClass("active")
.siblings()
.removeClass("active");
}
});
});
// 二级导航栏锚点点击切换
$(".position .fr a, .g-detail .detail .nav a").on("click", function(e) {
if (this.href.split("#")[1]) {
e.preventDefault();
$(this).addClass("active").siblings().removeClass("active");
$("body,html").animate({
scrollTop: $("#" + this.href.split("#")[1].toString()).offset().top - 85,
},
0
);
}
});
// 分页前进后退
$(".com-pages a:first").text("上一页");
$(".com-pages a:last").text("下一页");
});
// 默认动画效果修改
(function(h) {
h.extend(h.easing, {
easein: function(d, a, e, b, c) {
return b * (a /= c) * a + e;
},
easeinout: function(d, a, e, b, c) {
if (a < c / 2) return (2 * b * a * a) / (c * c) + e;
d = a - c / 2;
return (-2 * b * d * d) / (c * c) + (2 * b * d) / c + b / 2 + e;
},
easeout: function(d, a, e, b, c) {
return (-b * a * a) / (c * c) + (2 * b * a) / c + e;
},
expoin: function(d, a, e, b, c) {
d = 1;
b < 0 && ((d *= -1), (b *= -1));
return d * Math.exp((Math.log(b) / c) * a) + e;
},
expoout: function(d, a, e, b, c) {
d = 1;
b < 0 && ((d *= -1), (b *= -1));
return d * (-Math.exp((-Math.log(b) / c) * (a - c)) + b + 1) + e;
},
expoinout: function(d, a, e, b, c) {
d = 1;
b < 0 && ((d *= -1), (b *= -1));
return a < c / 2 ?
d * Math.exp((Math.log(b / 2) / (c / 2)) * a) + e :
d * (-Math.exp(((-2 * Math.log(b / 2)) / c) * (a - c)) + b + 1) + e;
},
bouncein: function(d, a, e, b, c) {
return b - jQuery.easing.bounceout(d, c - a, 0, b, c) + e;
},
bounceout: function(d, a, e, b, c) {
return (a /= c) < 1 / 2.75 ?
b * 7.5625 * a * a + e :
a < 2 / 2.75 ?
b * (7.5625 * (a -= 1.5 / 2.75) * a + 0.75) + e :
a < 2.5 / 2.75 ?
b * (7.5625 * (a -= 2.25 / 2.75) * a + 0.9375) + e :
b * (7.5625 * (a -= 2.625 / 2.75) * a + 0.984375) + e;
},
bounceinout: function(d, a, e, b, c) {
return a < c / 2 ?
jQuery.easing.bouncein(d, a * 2, 0, b, c) * 0.5 + e :
jQuery.easing.bounceout(d, a * 2 - c, 0, b, c) * 0.5 + b * 0.5 + e;
},
elasin: function(d, a, e, b, c) {
var d = 1.70158,
f = 0,
g = b;
if (a == 0) return e;
if ((a /= c) == 1) return e + b;
f || (f = c * 0.3);
g < Math.abs(b) ?
((g = b), (d = f / 4)) :
(d = (f / (2 * Math.PI)) * Math.asin(b / g));
return (-(
g *
Math.pow(2, 10 * (a -= 1)) *
Math.sin(((a * c - d) * 2 * Math.PI) / f)
) + e);
},
elasout: function(d, a, e, b, c) {
var d = 1.70158,
f = 0,
g = b;
if (a == 0) return e;
if ((a /= c) == 1) return e + b;
f || (f = c * 0.3);
g < Math.abs(b) ?
((g = b), (d = f / 4)) :
(d = (f / (2 * Math.PI)) * Math.asin(b / g));
return (
g * Math.pow(2, -10 * a) * Math.sin(((a * c - d) * 2 * Math.PI) / f) +
b +
e
);
},
elasinout: function(d, a, e, b, c) {
var d = 1.70158,
f = 0,
g = b;
if (a == 0) return e;
if ((a /= c / 2) == 2) return e + b;
f || (f = c * 0.3 * 1.5);
g < Math.abs(b) ?
((g = b), (d = f / 4)) :
(d = (f / (2 * Math.PI)) * Math.asin(b / g));
return a < 1 ?
-0.5 *
g *
Math.pow(2, 10 * (a -= 1)) *
Math.sin(((a * c - d) * 2 * Math.PI) / f) +
e :
g *
Math.pow(2, -10 * (a -= 1)) *
Math.sin(((a * c - d) * 2 * Math.PI) / f) *
0.5 +
b +
e;
},
backin: function(d, a, e, b, c) {
return b * (a /= c) * a * (2.70158 * a - 1.70158) + e;
},
backout: function(d, a, e, b, c) {
return b * ((a = a / c - 1) * a * (2.70158 * a + 1.70158) + 1) + e;
},
backinout: function(d, a, e, b, c) {
d = 1.70158;
return (a /= c / 2) < 1 ?
(b / 2) * a * a * (((d *= 1.525) + 1) * a - d) + e :
(b / 2) * ((a -= 2) * a * (((d *= 1.525) + 1) * a + d) + 2) + e;
},
linear: function(d, a, e, b, c) {
return (b * a) / c + e;
},
});
})(jQuery);
// 背景相对移动动画封装
(function($, window, document, undefined) {
$.fn.bgmove = function(options) {
var defaults = {
speed: 500,
fx: "linear",
};
var last = $(this).parent().find(".active");
var bg = $(this).parent().find(".bg");
options = $.extend({}, defaults, options);
var move = function(target) {
bg.stop().animate({
left: target.position().left + parseInt(target.css("marginLeft")),
width: target.outerWidth(),
},
options.speed,
options.fx
);
};
$(this).on("mousemove", function() {
move($(this));
});
$(this)
.parent()
.on("mouseleave", function() {
move(last);
});
$(window).resize(function() {
move(last);
});
move(last);
};
})(jQuery, window, document);
// 点击切换当前
(function($, window, document, undefined) {
$.fn.toggleOn = function(target) {
$(this).on("click", function() {
$(this).addClass("on").siblings().removeClass("on");
if (target) {
target.eq($(this).index()).addClass("on").siblings().removeClass("on");
}
});
};
})(jQuery, window, document);
// 点击加载更多
// (function($, window, document, undefined) {
// $.fn.getMore = function(btn, num, loadNum, speed) {
// var sum = $(this).find("li").hide().size();
// if (num >= sum) btn.hide();
// $(this)
// .find("li:lt(" + num + ")")
// .show();
// that = $(this);
// btn.on("click", function() {
// num += loadNum;
// that.find("li:lt(" + num + ")").slideDown(speed ? speed : 400);
// if (num >= sum) $(this).hide();
// });
// };
// })(jQuery, window, document);
function chkForm3() {
var name = $("#namea").val();
var shouji = $("#shoujia").val();
if (name == "") {
alert("请填写您的姓名");
return false;
}
if (shouji == "") {
alert("请填写您的电话");
return false;
}
subForm3();
}
function subForm3() {
$.ajax({
type: "POST",
url: $("#frm3").attr("action"),
data: $("#frm3").serialize(),
success: function(msg) {
msg = eval("(" + msg + ")");
if (msg.status == 1) {
alert("谢谢您的留言,我们会尽快与您联系.");
window.location.reload();
} else {
alert(msg.txt);
}
},
});
}
(function() {
window.scrollReveal = new scrollReveal({
reset: true,
move: "50px",
});
})();
// 回到顶部
$(document).ready(function() {
$("#top").hide();
$(function() {
//检测屏幕高度
var height = $(window).height();
$(window).scroll(function() {
if ($(window).scrollTop() > height) {
$("#top").fadeIn(500);
} else {
$("#top").fadeOut(500);
}
});
$("#top").click(function() {
$("body,html").animate({
scrollTop: 0,
},
100
);
return false;
});
});
});
//手机顶部导航
$(function() {
$(".m_nav").click(function() {
if ($(".index_nav").css("display") == "none") {
$(".index_nav").slideDown();
$("#nav_line2").css("opacity", 0);
$("#nav_line1").css("transform", "rotate(45deg)");
$("#nav_line3").css("transform", "rotate(-45deg)");
} else {
$(".index_nav").slideUp();
$("#nav_line2").css("opacity", 1);
$("#nav_line1").css("transform", "rotate(0deg)");
$("#nav_line3").css("transform", "rotate(0deg)");
}
});
$(".nav_li").click(function() {
if ($(this).find(".sub_nav").css("display") == "none") {
$(".nav_li .sub_nav").slideUp();
$(this).find(".sub_nav").slideDown();
$(".nav_li .m_right").removeClass("xuanz");
$(this).find(".m_right").addClass("xuanz");
} else {
$(".nav_li .m_right").removeClass("xuanz");
$(".nav_li .sub_nav").slideUp();
}
});
});