var BodyPading = {};
(function ($) {
$.extend({
urlGet: function () {
var aQuery = window.location.href.split("?"); //取得Get参数
var aGET = new Array();
if (aQuery.length > 1) {
var aBuf = aQuery[1].split("&");
for (var i = 0, iLoop = aBuf.length; i < iLoop; i++) {
var aTmp = aBuf[i].split("="); //分离key与Value
aGET[aTmp[0]] = aTmp[1];
}
}
return aGET;
}
});
})(jQuery);
var isTouch = ('ontouchstart' in window);
webresponseive.bodypadding = {
"xs": {
top: 0, bottom: 0
},
"lg": {
top: 0, bottom: 0
},
"md": {
top: 0, bottom: 0
},
"sm": {
top: 0, bottom: 0
}
};
webresponseive.banners.push(
{
title: "首页banner",
lg: {
height: 410,
css: { "background-size": "inital" }
},
md: {
height: 350,
css: { "background-size": "cover" }
},
sm: {
height: 300,
css: { "background-size": "cover" }
},
xs: {
ratio: 3,
css: { "background-size": "cover" }
},
el: "#index-swiper-container,#index-swiper-container .swiper-slide a"
}
);
webresponseive.viewport.lg.push(function () {
$(".pagination").removeClass("pagination-md").addClass("pagination-lg");
$(".kj-shopcart-suminfo-box .btn").removeClass("btn-sm");
});
webresponseive.viewport.md.push(function () {
$(".pagination").removeClass("pagination-md").addClass("pagination-lg");
$(".kj-shopcart-suminfo-box .btn").removeClass("btn-sm");
});
webresponseive.viewport.sm.push(function () {
$(".pagination").removeClass("pagination-lg").addClass("pagination-md");
$(".kj-shopcart-suminfo-box .btn").addClass("btn-sm");
});
webresponseive.viewport.xs.push(function () {
$(".pagination").removeClass("pagination-lg").addClass("pagination-md");
$(".kj-shopcart-suminfo-box .btn").addClass("btn-sm");
});
webresponseive.resize.push(function () {
scroolupanddown.resize();
scroolfloor.resize();
});
webresponseive.$fn.push(function () {
scroolupanddown.init();
InitUserLoginStatus({
el: "#loginstatusbox", ondone: function (data) {
if (data.result == "1") {
$(".kc_user_head_logo").attr("src", data.headlogo);
$("#homeloginstatus").html('
\
'+ data.rolename + '
');
$("#ineuserstausboxx").html('Member Center | Sign Out ');
NowUserInfo = data;
}
else if (data.result == "-1") {
$(".kj-shopcart-count").html("0").hide();
$("[loginstatus]").html('' + rclng.login + '' + rclng.register + '');
}
GetShopChatCountForNowUser({
callback: function (data) {
if (data.result == "1") {
if (data.data.count == "0" || data.data.count == "") {
$(".kj-shopcart-count").html(data.data.count).hide();
}
else {
$(".kj-shopcart-count").html(data.data.count).show();
}
}
}
});
}
});
var turl = location.href;
turl = turl.replace("//", "");
turl = turl.substr(turl.indexOf("/"));
$(".list-group-item > a[href*='" + turl + "']").parent().addClass("active");
});
var ShowShopConfig = {
defaultcss: false,
aftershopcartfill: function (o) {
if (o.length == 0) {
$(".kj-shopcart-count").html(o.length).hide();
}
else {
$(".kj-shopcart-count").html(o.length).show();
}
},
afteraddtocart: function (o) {
if (o != null) {
var of = $(o).offset();
var cof = $(".kj-shopcart-count[atom='1']");
if ($(o).attr("relrole") != null) {
if ($(".kj-shopcart-count[atom='1'][relrole='" + $(o).attr("relrole") + "']").length > 0) {
cof = $(".kj-shopcart-count[atom='1'][relrole='" + $(o).attr("relrole") + "']");
}
}
if (cof != null) {
cof.show();
var tof = cof.offset();
var gotop = of.top - 80;
var goleft = of.left;
//if (tof != null){
// gotop = tof.top;
// goleft = tof.left;
//}
//else {
//}
var gift = $('
')
$("body").append(gift);
gift.animate({ left: goleft + "px", top: gotop + "px", opacity: 0 }, 1000, function () {
gift.remove();
});
}
}
},
viewminshopcartbox: function (o) {
// var offset = $(o).offset();
// $("#ShopCartBox").css({ left: offset.left - ($("#ShopCartBox").width() - $(o).outerWidth()) + "px", top: offset.top + $(o).outerHeight() + "px" }).toggle();
}
};
function UserLoginByAjax(el, callback) {
VerifyFormData({ el: el }, function (postdata, extdata) {
postdata = $.extend(postdata, { a: 'ajaxuserlogin' });
$("input[role='userloginbtn']").val(rclng.loading).attr("disabled", true);
$.post(webhttp + "index.aspx", postdata,
function (data, textStatus) {
rv = data;
if (rv.Status == "1") {
if (callback != undefined) {
callback(rv.StrResult);
}
else {
location.href = rv.StrResult;
}
}
else {
$("input[role='userloginbtn']").val(rclng.login).attr("disabled", false);
$(".userlogin_verifycodedl").show();
alert(rv.ClientMsg);
}
}, "json");
});
}
var scroolupanddown = {
init: function () {
//$(".kj-scroll-ctrbtn .angle-double-down").click(function () {
// $("html,body").animate({ scrollTop: $(document).height() - $(window).height() }, 1000);
//});
//$(".kj-scroll-ctrbtn .angle-double-up").click(function () {
// $("html,body").animate({ scrollTop: 0 }, 1000);
//});
scroolupanddown.resize();
},
resize: function () {
/*scroll to up or down*/
//if (webresponseive.ispagebottom) {
// $(".kj-scroll-ctrbtn .angle-double-down").hide();
//}
//else {
// $(".kj-scroll-ctrbtn .angle-double-down").show();
//}
//if (webresponseive.ispagetop) {
// $(".kj-scroll-ctrbtn .angle-double-up").hide();
//}
//else {
// $(".kj-scroll-ctrbtn .angle-double-up").show();
//}
if ($(".btn-kj-struc-search").length > 0) {
var oft = $(".btn-kj-struc-search").offset();
var ow = $(".btn-kj-struc-search").outerWidth();
if (oft.left + ow + 10 + 60 < webresponseive.currentviewWith) {
$(".kj-scroll-ctrbtn").css("left", (oft.left + ow + 10) + "px");
}
}
if (webresponseive.currentviewport == "xs") {
$(".kj-pro-list-subinfo-box").width(webresponseive.currentviewWith - 175);
}
else {
$(".kj-pro-list-subinfo-box").css("width", "auto");
}
}
};
var scroolfloor = {
needhidden: function () {
var oft = $(".kj-product-floor").eq(0).offset();
var ow = $(".kj-scroll-floorbox").outerWidth();
if (oft.left - ow - 10 > 0) {
return false;
}
return true;
},
flooroffsets: [],
init: function () {
var floors = $('');
$(".kj-product-floor").each(function () {
var floortitle = $(".kj-index-floor-headtitle a", this).html();
var flooritem = $('' + floortitle + '');
var _thisfloor = $(this).offset();
flooritem.click(function () {
$('html,body').animate({ scrollTop: _thisfloor.top + 2 }, 500);
});
$(".kj-scroll-flooritems", floors).append(flooritem);
scroolfloor.flooroffsets.push({ el: flooritem, top: _thisfloor.top - 50 });
});
var gototop = $('TOP');
gototop.click(function () {
$('html,body').animate({ scrollTop: 0 }, 500);
});
$(".kj-scroll-flooritems", floors).append(gototop);
$("body").append(floors);
scroolfloor.resize();
scroolfloor.scroll();
},
scroll: function () {
var wt = $(window).scrollTop();
// console.log(wt);
$(".kj-scroll-floor-href").removeClass("flooractive");
var found = null;
for (var i = 0; i < scroolfloor.flooroffsets.length; i++) {
if (wt >= scroolfloor.flooroffsets[i].top) {
found = scroolfloor.flooroffsets[i];
}
}
if (found != null) {
$(found.el).addClass("flooractive");
if (!scroolfloor.needhidden()) {
$(".kj-scroll-floorbox").show();
}
}
else {
$(".kj-scroll-floorbox").hide();
}
if ($(".kj-product-floor").length > 0) {
var lastoffset = $(".kj-product-floor:last").offset();
var lastheight = $(".kj-product-floor:last").height();
if (wt > (lastoffset.top + lastheight)) {
$(".kj-scroll-floorbox").hide();
}
}
},
resize: function () {
if ($(".kj-product-floor").length > 0) {
var oft = $(".kj-product-floor").eq(0).offset();
var ow = $(".kj-scroll-floorbox").outerWidth();
if (oft.left - ow - 10 > 0) {
$(".kj-scroll-floorbox").css("left", (oft.left - ow - 10) + "px").show();
}
else {
$(".kj-scroll-floorbox").hide();
}
var wt = $(window).scrollTop();
var lastoffset = $(".kj-product-floor:last").offset();
var lastheight = $(".kj-product-floor:last").height();
if (wt > (lastoffset.top + lastheight)) {
$(".kj-scroll-floorbox").hide();
}
}
}
};
/*楼层end*/
//
webresponseive.scroll.push(function () {
var wt = $(window).scrollTop();
if (wt > 10) {
$(".kj_nav").css({ "box-shadow": "0px 0px 10px rgba(100,100,100,.8)" });
}
else {
$(".kj_nav").css({
"box-shadow": "none"
});
}
scroolupanddown.resize();
scroolfloor.scroll();
});
/*浮动栏目*/
webresponseive.$fn.push(function () {
$("#floatbar-arraw-up").click(function () {
$("html,body").animate({ scrollTop: 0 }, 500);
});
$(".kj-scroll-ctrbtn .angle-double-up").click(function () {
$(".kj-scroll-ctrbtn .angle-double-up").hide();
var h = $(".kj_footer").outerHeight();
$(".kj_footer").css("bottom", (h * -1) + "px").addClass("kj_footer-fixed").animate({ bottom: 0 }, 500, function () {
$(".kj-scroll-ctrbtn").css("bottom", h + "px").show();
$(".kj-scroll-ctrbtn .angle-double-down").show();
});
});
$(".kj-scroll-ctrbtn .angle-double-down").click(function () {
$(".kj-scroll-ctrbtn .angle-double-down").hide();
var h = $(".kj_footer").outerHeight();
$(".kj_footer").animate({ bottom: -1 * h }, 500, function () {
$(".kj_footer").removeClass("kj_footer-fixed");
$(".kj-scroll-ctrbtn").css("bottom", 0);
$(".kj-scroll-ctrbtn .angle-double-up").show();
});
});
});
webresponseive.scroll.push(function () {
var wt = $(window).scrollTop();
if (wt > 0) {
$("#floatbar-arraw-up").show();
}
else {
$("#floatbar-arraw-up").hide();
}
});
/*end*/