You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.4 KiB
JavaScript

var pop = {
init: function() {
var e = $(".pop_btn");
e.each(function() {
var e = $(this),
a = $(e.data("targetpop"));
e.bind("click",
function(n) {
n.preventDefault(),
$(".pop.popshow").not(a).removeClass("popshow"),
$(".pop_btn.active").not(e).removeClass("active"),
a.toggleClass("popshow"),
e.toggleClass("active"),
a.hasClass("popshow") && ($(window).unbind("click").bind("click",
function(e) {
$(e.target).closest(".pop").length || $(e.target).closest(".pop_btn").length || ($(".pop_btn.active").removeClass("active"), $(".pop.popshow").removeClass("popshow"))
}), nav.closeSubmenu())
})
})
},
close: function() {
$(".pop").removeClass("popshow"),
$(".pop_btn").removeClass("active")
}
},
nav = {
init: function() {
$("nav .menu-btn").click(function() {
$("body").hasClass("nav-open") ? nav.close() : nav.open()
}),
$("#nav_overlayer").click(nav.close),
$("nav .has_sub").each(function() {
function e(e) {
$("nav").addClass("open_sub"),
n.addClass("open"),
$(e).addClass("show"),
$(window).unbind("click").bind("click",
function(e) {
$(e.target).closest(".subnav").length || $(e.target).closest(".submenu_btn").length || $(e.target).closest(".subnav .back_btn").length || a()
}),
pop.close(),
console.log(e)
}
function a() {
$("nav").removeClass("open_sub"),
$(".subnav").removeClass("show"),
n.removeClass("open"),
$(window).unbind("click"),
console.log("close")
}
var n = $(this);
n.find(".submenu_btn").click(function(n) {
var o = $(this).attr("href");
n.preventDefault(),
$("nav").hasClass("open_sub") ? a() : e(o)
}),
n.find(".back_btn").click(a)
}),
nav.lang()
},
open: function() {
$("#nav_overlayer").fadeTo(400, .6),
$("body").addClass("nav-open")
},
close: function() {
$("body").removeClass("nav-open"),
$("nav").removeClass("open_sub"),
$("nav .open").removeClass("open"),
$("#nav_overlayer").fadeTo(400, 0,
function() {
$("#nav_overlayer").hide()
})
},
closeSubmenu: function() {
$("body").css("overflow", "auto"),
$("nav").removeClass("open_sub"),
$("nav .has_sub").removeClass("open")
},
lang: function() {
var e = "zh-CN" == window.currLan ? "en-US": "zh-CN";
$(".lang_btn").click(function(a) {
return cookie.setCookie("local", e),
location = location,
a.stopPropagation(),
!1
})
}
}
//$(document).ready(function() {
//browsers.init(),
//prevent.init(),
//pop.init(),
//nav.init()
//fixSize.init()
//!Modernizr.touch && $("#head").length && maxheader.init(),
//$(".swiper-container").length && ics && swiper.init(),
//$(".modal").length && ics && modal.init(),
//proloader.init()
//});