/*--------------------------------DOM 加载完毕-------------------------------*/ $( document).ready(function(){ /* ============================== 公共脚本 ============================== Begin */ /* ---------- 输入框点击去除默认文字 ---------- */ $("input.input_text").each(function(){ var _this = $(this); if( _this.val() != ""){ _this.prev("label.default_value").hide(); //输入框有值时,隐藏默认值 } _this.focus(function(){ _this.prev("label.default_value").hide(); }) .blur(function(){ if(_this.val()==""){ _this.prev("label.default_value").show(); } }); }); /* ================================== index ================================== */ /* ---------- 首页大图轮转 promo ---------- */ $("#JS_promo a").addClass("bigimg"); $("#JS_promo img").banner_thaw({ thumbObj:"#JS_promoTriggers li", thumbNowClass:"current", changeTime:3000 }); /*detail tab*/ $("#JS_tabHolder .tab_item").each(function(index){ $(this).click(function(){ var _this=this; $(_this).children("span").addClass("current").parent(".tab_item").siblings().children("span").removeClass("current"); $(".JS_tabPanel").eq(index).show().siblings().hide(); }) }); $("#JS_tabHolder .tab_item:first").click(); /*filter*/ var timeFilterHover; $(".filter_select").hover(function(){ _this = $(this); timeFilterHover = setTimeout(function(){ _this.find(".select_list").show().parents(".filter_item").siblings().find(".select_list").hide() },100); },function(){ _this = $(this); clearTimeout(timeFilterHover); _this.find(".select_list").hide(); }); /*category 页面 pagination 点击后效果*/ $(".pagination a").click(function(){ $(this).addClass("current").siblings("a").removeClass("current"); }); /*product 页面 产品滚动效果*/ var g = $("#JS_productPic"); g.zoom({xzoom: 386,yzoom: 386,offset: 10,lens: 1}); if ($("#JS_thumbnailSlide li").length > 0) { $("#JS_thumbnailSlide").carousel({btnNext: "#JS_thumbnailNext",btnPrev: "#JS_thumbnailPrev",scrolls: 1,circular: false,visible: 4,vertical: false}) } var e = 60; var c = 300; var b = 600; $(".thumbnail ul li:first").addClass("hover"); var f, d; $(".thumbnail ul li").hover(function() { var i = $(this); clearTimeout(d); f = setTimeout(function() { i.addClass("hover").siblings().removeClass("hover"); $("#picture").attr("src", i.find("img").attr("src").replace(e + "X" + e, c + "X" + c)); $("#picture").parent("a").attr("href", i.find("img").attr("src").replace(e + "X" + e, b + "X" + b)) }, 150) }, function() { clearTimeout(f) }); $(".thumbnail ul li").click(function() { return false }); /* 侧边栏公共效果部分 点击效果 */ $(".aside_part_target").click(function(){ _this = $(this); if(_this.next(".category_sublist").length > 0){ _this.toggleClass("aside_part_target_current").next(".category_sublist").slideToggle(0) .parent(".aside_part_item").siblings(".aside_part_item") .find(".aside_part_target").removeClass("aside_part_target_current").end() .find(".category_sublist").slideUp(0); return false; }else{ _this.toggleClass("aside_part_target_current") .parent(".aside_part_item").siblings(".aside_part_item") .find(".aside_part_target").removeClass("aside_part_target_current").next(".category_sublist").slideUp(0); } }); /* lightbox */ $("a.lightbox").lightBox(); /* ============================== certification 页 脚本 ============================== */ /**-----------------------------------------------------------* * @name : Imgshow JS * @type : * @explain : */ var imgshowThumbItem = $("#JS_imgshowThumbSlide .list_item"); /*thumb slide*/ imgshowThumbItem.first().addClass("hover"); if(imgshowThumbItem.length > 0){ $("#JS_imgshowThumbSlide").carousel({ btnNext:"#JS_imgshowThumbNext", btnPrev:"#JS_imgshowThumbPrev", scrolls:1, vertical:false, circular: false, visible:3 }); }; /*change picture*/ var _small_img = 60; var imgshowPic = $("#JS_imgshowPic"); var imgshowPicBox = $("#JS_imgshowPicBox"); var imgshowPicId = "JS_imgshowPic"; var imgshowPicBoxId = "JS_imgshowPicBox"; imgshowPic.loadthumb({"src":imgshowPicBox.find("img").attr("src"),"imgId":imgshowPicId,"parentId":imgshowPicBoxId}); imgshowThumbItem.click(function(){ var _this=$(this); _this.addClass("hover").siblings().removeClass("hover"); imgshowPic.attr("src",_this.find('img').attr("src").replace(_small_img + "X" + _small_img,"300X300")); imgshowPicBox.find("a").attr("href",_this.find('img').attr("src").replace(_small_img + "X" + _small_img,"600X600")); imgshowPic.loadthumb({"src":imgshowPicBox.find("img").attr("src"),"imgId":imgshowPicId,"parentId":imgshowPicBoxId}); return false; }); /*certification 页面的切换*/ $(".imgshow_thumb .cert_tips:first").show(); $("#JS_imgshowThumbSlide li").each(function(index){ $(this).click(function(){ $(this).addClass("hover").siblings().removeClass("hover"); $(this).parents(".imgshow_thumb").find(".cert_tips").eq(index).show().siblings().hide(); }); }); /*validate*/ $("#form_validate").validate(); }); //百度统计 var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?b7c48f376011f156ae0d4758abc837b7"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();