$(function () {
//回车搜索事件
$("#searchp").keydown(function (e) {
if (e.keyCode == 13) {
var code = $(this).attr("yz_code");
var url = "/search.aspx?keyword=" + $(this).val() + "&yz_code=" + code;
window.location.href="vsm;"
}
});
//点击搜索事件
$("#search1").click(function (e) {
var code = $(this).attr("yz_code");
var url = "/search.aspx?keyword=" + $(this).val() + "&yz_code=" + code;
window.location.href="vsm;"
});
//products选项卡切换
$(".nav-isotope ul li").click(function () {
var index = $(this).index();
$(this).addClass("active").siblings().removeClass("active");
$(".products-active").eq(index).show().siblings().hide();
});
//about 选项卡切换
$("#about ul li").click(function () {
var index = $(this).index();
$(this).addClass("active").siblings().removeClass("active");
$(".about-active").eq(index).show().siblings().hide();
});
//返回顶部
$(window).scroll(function () {
var top = $(this).scrollTop();
if (top > 200) {
$(".back-top,.desnav").fadeIn(200);
} else {
$(".back-top,.desnav").fadeOut(200);
}
})
$(".back-top").click(function () {
$("html,body").animate({ scrollTop: 0 }, 700);
});
//手机导航切换按钮
$(".navbar-toggle").click(function () {
$(".navbar-collapse").slideToggle(300);
$(".navbar-right li").click(function () {
$(this).toggleClass("open").siblings().removeClass("open");
});
});
//内容页图片点击切换
var imgnum = $(".flexportfolio .slides li img").length;
var clicknum = 0;
$(".flex-direction-nav .flex-next").click(function () {
clicknum++;
if (clicknum >= imgnum) { clicknum = 0 }
$(".flexportfolio .slides li").eq(clicknum).show(200).siblings().hide(200);
});
$(".flex-direction-nav .flex-prev").click(function () {
clicknum--;
if (clicknum < 0) { clicknum = imgnum }
$(".flexportfolio .slides li").eq(clicknum).show(200).siblings().hide(200);
});
//关于我们页标签切换
$(".landing-tab ul li,.featured-tab ul li").click(function () {
var index = $(this).index();
$(".tab-content .tab-pane").eq(index).addClass("active").siblings().removeClass("active");
$(this).addClass("active").siblings().removeClass("active");
})
//career页切换
$(".panel-heading").click(function () {
$(this).siblings().toggleClass("in");
});
//新闻列表页选项卡切换
$(".widget-tab ul li").click(function () {
var index = $(this).index();
$(this).addClass("active").siblings().removeClass("active");
$("#tab" + (index + 1)).addClass("active").siblings().removeClass("active");
});
//产品列表页切换
$(".isotope-nav ul li a").click(function () {
$(".isotope-nav ul li a").removeClass("active");
$(this).addClass("active");
});
$(".myccs strong").each(function (index, e) {
$(this).prepend("" + (index + 1) + "")
})
$(".tab-content strong").each(function (index, e) {
var text = $(this).text().replace(":", "");
if(text.length>0){
var top = $(this).offset().top + 50;
$(this).attr("id", "c" + index);
var href="mpdbujpo.isfg;"
$(".desnav ul").append("
" + text + "")
$(this).prepend("" + (index + 1) + "");
}
})
$(".desnav ul li").click(function () {
$(this).addClass('active').siblings().removeClass('active');
})
//颜色切换
$(window).scroll(function () {
var top = $(this).scrollTop();
if (top > 50) {
$(".main-menu").addClass("active");
} else {
$(".main-menu").removeClass("active");
}
})
})
//菜单栏
$(function () {
var a = function (a, b) {
return function () {
return a.apply(b, arguments)
}
}; !
function (b, c) {
var d, e, f, g;
return e = function () {
function c(c) {
this.element = c,
this._clickEvent = a(this._clickEvent, this),
this.element = b(this.element),
this.nav = this.element.closest(".nav"),
this.dropdown = this.element.parent().find(".dropdown-menu"),
this.element.on("click", this._clickEvent)
}
return c.prototype._clickEvent = function (a) {
return this.dropdown.hasClass("shown") || a.preventDefault(),
b(".dropdown-toggle").not(this.element).closest(".active").removeClass("active").find(".dropdown-menu").removeClass("shown"),
this.dropdown.toggleClass("shown"),
this.element.parent().toggleClass("active")
},
c
}(),
f = function () {
function d(c, d, e, f) {
this.button = c,
this.element = d,
this.location = e,
this.offcanvas = f,
this._getFade = a(this._getFade, this),
this._getCss = a(this._getCss, this),
this._touchEnd = a(this._touchEnd, this),
this._touchMove = a(this._touchMove, this),
this._touchStart = a(this._touchStart, this),
this.endThreshold = 130,
this.startThreshold = this.element.hasClass("navbar-offcanvas-right") ? b("body").outerWidth() - 60 : 20,
this.maxStartThreshold = this.element.hasClass("navbar-offcanvas-right") ? b("body").outerWidth() - 20 : 60,
this.currentX = 0,
this.fade = !!this.element.hasClass("navbar-offcanvas-fade"),
b(document).on("touchstart", this._touchStart),
b(document).on("touchmove", this._touchMove),
b(document).on("touchend", this._touchEnd)
}
return d.prototype._touchStart = function (a) {
if (this.startX = a.originalEvent.touches[0].pageX, this.element.is(".in")) {
return this.element.height(b(c).outerHeight())
}
},
d.prototype._touchMove = function (a) {
var c;
if (b(a.target).parents(".navbar-offcanvas").length > 0) {
return !0
}
if (this.startX > this.startThreshold && this.startX < this.maxStartThreshold) {
if (a.preventDefault(), c = a.originalEvent.touches[0].pageX - this.startX, c = this.element.hasClass("navbar-offcanvas-right") ? -c : c, Math.abs(c) < this.element.outerWidth()) {
return this.element.css(this._getCss(c)),
this.element.css(this._getFade(c))
}
} else {
if (this.element.hasClass("in") && (a.preventDefault(), c = a.originalEvent.touches[0].pageX + (this.currentX - this.startX), c = this.element.hasClass("navbar-offcanvas-right") ? -c : c, Math.abs(c) < this.element.outerWidth())) {
return this.element.css(this._getCss(c)),
this.element.css(this._getFade(c))
}
}
},
d.prototype._touchEnd = function (a) {
var c, d;
return b(a.target).parents(".navbar-offcanvas").length > 0 || (d = a.originalEvent.changedTouches[0].pageX, c = this.element.hasClass("navbar-offcanvas-right") ? Math.abs(d) > this.endThreshold + 50 : d < this.endThreshold + 50, this.element.hasClass("in") && c ? (this.currentX = 0, this.element.removeClass("in").css(this._clearCss()), this.button.removeClass("is-open")) : Math.abs(d - this.startX) > this.endThreshold && this.startX > this.startThreshold && this.startX < this.maxStartThreshold ? (this.currentX = this.element.hasClass("navbar-offcanvas-right") ? -this.element.outerWidth() : this.element.outerWidth(), this.element.toggleClass("in").css(this._clearCss()), this.button.toggleClass("is-open")) : this.element.css(this._clearCss()), this.offcanvas.bodyOverflow())
},
d.prototype._getCss = function (a) {
return a = this.element.hasClass("navbar-offcanvas-right") ? -a : a,
{
"-webkit-transform": "translate3d(" + a + "px, 0px, 0px)",
"-webkit-transition-duration": "0s",
"-moz-transform": "translate3d(" + a + "px, 0px, 0px)",
"-moz-transition": "0s",
"-o-transform": "translate3d(" + a + "px, 0px, 0px)",
"-o-transition": "0s",
transform: "translate3d(" + a + "px, 0px, 0px)",
transition: "0s"
}
},
d.prototype._getFade = function (a) {
return this.fade ? {
opacity: a / this.element.outerWidth()
} : {}
},
d.prototype._clearCss = function () {
return {
"-webkit-transform": "",
"-webkit-transition-duration": "",
"-moz-transform": "",
"-moz-transition": "",
"-o-transform": "",
"-o-transition": "",
transform: "",
transition: "",
opacity: ""
}
},
d
}(),
c.Offcanvas = d = function () {
function d(c) {
var d, g;
this.element = c,
this.bodyOverflow = a(this.bodyOverflow, this),
this._sendEventsAfter = a(this._sendEventsAfter, this),
this._sendEventsBefore = a(this._sendEventsBefore, this),
this._documentClicked = a(this._documentClicked, this),
this._close = a(this._close, this),
this._open = a(this._open, this),
this._clicked = a(this._clicked, this),
this._navbarHeight = a(this._navbarHeight, this),
g = !!this.element.attr("data-target") && this.element.attr("data-target"),
g ? (this.target = b(g), this.target.length && !this.target.hasClass("js-offcanvas-done") && (this.element.addClass("js-offcanvas-has-events"), this.location = this.target.hasClass("navbar-offcanvas-right") ? "right" : "left", this.target.addClass(transform ? "offcanvas-transform js-offcanvas-done" : "offcanvas-position js-offcanvas-done"), this.target.data("offcanvas", this), this.element.on("click", this._clicked), this.target.on("transitionend",
function (a) {
return function () {
if (a.target.is(":not(.in)")) {
return a.target.height("")
}
}
}(this)), b(document).on("click", this._documentClicked), this.target.hasClass("navbar-offcanvas-touch") && (d = new f(this.element, this.target, this.location, this)), this.target.find(".dropdown-toggle").each(function () {
var a;
return a = new e(this)
}), this.target.on("offcanvas.toggle",
function (a) {
return function (b) {
return a._clicked(b)
}
}(this)), this.target.on("offcanvas.close",
function (a) {
return function (b) {
return a._close(b)
}
}(this)), this.target.on("offcanvas.open",
function (a) {
return function (b) {
return a._open(b)
}
}(this)))) : console.warn("Offcanvas: `data-target` attribute must be present.")
}
return d.prototype._navbarHeight = function () {
if (this.target.is(".in")) {
return this.target.height(b(c).outerHeight())
}
},
d.prototype._clicked = function (a) {
return a.preventDefault(),
this._sendEventsBefore(),
b(".navbar-offcanvas").not(this.target).trigger("offcanvas.close"),
this.target.toggleClass("in"),
this.element.toggleClass("is-open"),
this._navbarHeight(),
this.bodyOverflow()
},
d.prototype._open = function (a) {
if (a.preventDefault(), !this.target.is(".in")) {
return this._sendEventsBefore(),
this.target.addClass("in"),
this.element.addClass("is-open"),
this._navbarHeight(),
this.bodyOverflow()
}
},
d.prototype._close = function (a) {
if (a.preventDefault(), !this.target.is(":not(.in)")) {
return this._sendEventsBefore(),
this.target.removeClass("in"),
this.element.removeClass("is-open"),
this._navbarHeight(),
this.bodyOverflow()
}
},
d.prototype._documentClicked = function (a) {
var c;
if (c = b(a.target), !c.hasClass("offcanvas-toggle") && 0 === c.parents(".offcanvas-toggle").length && 0 === c.parents(".navbar-offcanvas").length && !c.hasClass("navbar-offcanvas") && this.target.hasClass("in")) {
return a.preventDefault(),
this._sendEventsBefore(),
this.target.removeClass("in"),
this.element.removeClass("is-open"),
this._navbarHeight(),
this.bodyOverflow()
}
},
d.prototype._sendEventsBefore = function () {
return this.target.hasClass("in") ? this.target.trigger("show.bs.offcanvas") : this.target.trigger("hide.bs.offcanvas")
},
d.prototype._sendEventsAfter = function () {
return this.target.hasClass("in") ? this.target.trigger("shown.bs.offcanvas") : this.target.trigger("hidden.bs.offcanvas")
},
d.prototype.bodyOverflow = function () {
return this.target.is(".in") ? b("body").addClass("offcanvas-stop-scrolling") : b("body").removeClass("offcanvas-stop-scrolling"),
this._sendEventsAfter()
},
d
}(),
g = function (a) {
return function () {
var b, c, d, e;
return c = document.createElement("div"),
e = "translate3d(0px, 0px, 0px)",
d = /translate3d\(0px, 0px, 0px\)/g,
c.style.cssText = "-webkit-transform: " + e + "; -moz-transform: " + e + "; -o-transform: " + e + "; transform: " + e,
b = c.style.cssText.match(d),
a.transform = null != b.length
}
}(this),
b(function () {
return g(),
b('[data-toggle="offcanvas"]').each(function () {
var a;
return a = new d(b(this))
}),
b(c).on("resize",
function () {
return b(".navbar-offcanvas.in").each(function () {
return b(this).height("").removeClass("in")
}),
b(".offcanvas-toggle").removeClass("is-open")
}),
b(".offcanvas-toggle").each(function () {
return b(this).on("click",
function (a) {
var c, d;
if (!b(this).hasClass("js-offcanvas-has-events") && (d = b(this).attr("data-target"), c = b(d))) {
return c.height(""),
c.removeClass("in"),
b("body").css({
overflow: "",
position: ""
})
}
})
})
})
}(window.jQuery, window)
});