// javascript document //全局js $(function(){ //start $("#header .menu_en").hover(function(){ $(this).find(".nav").fadein(200) },function(){ $(this).find(".nav").stop().fadeout(50) }) //placeholder if('placeholder' in document.createelement('input')==false){ $("input,textarea").each(function(index, element) { if($(this).attr("placeholder")!=undefined){ if($(this).attr("type")!="password"){ $(this).val($(this).attr("placeholder")); $(this).attr("onfocus","if(this.value=='"+$(this).attr("placeholder")+"')this.value=''"); $(this).attr("onblur","if(this.value=='')this.value='"+$(this).attr("placeholder")+"'"); } } }); } $(".passwd").each(function(index, element) { var t=$(this); if('placeholder' in document.createelement('input')==false){ $(this).find(".b").focus(function(){ $(this).hide(); t.find(".a").focus(); }); $(this).find(".a").focus(function(){ t.find(".b").hide(); }); $(this).find(".a").blur(function(){ if($(this).val()==""){ t.find(".b").show(); } }); } else{ t.find(".a").attr("placeholder",t.find(".b").attr("placeholder")); t.find(".b").remove(); } }); // 公用 var _h; $(document).on("click", ".select-box dt a", function (e) { e.preventdefault(); e.stoppropagation(); $(this).parent().toggleclass("open"); $(this).parents(".sc_com").toggleclass("ieopen"); $(this).parent().parent(".select-box").find("dd").toggle(); _h = $(this).parents(".sc_com").find("dd").height() if(_h>240){ $(this).parents(".sc_com").find("dd").addclass("scroll-x") } }) $(document).on("click", ".select-box dd a", function (e) { $(this).addclass("on").siblings().removeclass("on"); $(this).parents(".select-box").find("dt b").html($(this).html()); $(".select-box dt").toggleclass("open"); $(".select-box dd").hide(); $(this).parents(".select-box").find("dt b").css({"color":"#474747"}) }) $(document).on("click",".search_header .sea .btn",function(e){ e.preventdefault(); e.stoppropagation(); $(".input_search").toggleclass("on") }) $(document).on("click",".input_search input,.input_search .btn",function(e){ e.preventdefault(); e.stoppropagation(); }) $(document).click(function () { $(".select-box dt").removeclass("open"); $(".select-box dd").hide(); $(".sc_com").removeclass("ieopen"); $(".input_search").removeclass("on") }) $(".service_com li").hover(function(){ $(this).addclass("on").siblings().removeclass("on"); var _scr = $(this).find("img").attr("src") var _scr2 = $(this).find("img").attr("data-src") $(this).find("img").attr({"src":_scr2}) $(this).find("img").attr({"data-src":_scr}) },function(){ $(this).removeclass("on"); var _scr = $(this).find("img").attr("src") var _scr2 = $(this).find("img").attr("data-src") $(this).find("img").attr({"src":_scr2}) $(this).find("img").attr({"data-src":_scr}) }) //end }); function hoveron(ele,eleon){ var n=$(eleon).index(); $(ele).mouseenter(function(){ $(ele).siblings(".on").removeclass("on") $(this).addclass("on") }); $(ele).mouseleave(function(){ $(this).removeclass("on") $(ele).eq(n).addclass("on").siblings().removeclass("on") }) }