/** * tabs * @author lzf */ function tabs(tabTitle,tab_content){ var index=$(tabTitle).children(".hover").index() $(tab_content).children().eq(index).show().siblings().hide(); $(tabTitle).children().click(function(){ var index=$(this).index(); $(this).addClass("hover").siblings().removeClass("hover"); $(tab_content).children().eq(index).show().siblings().hide(); return false; }); } /** * scrollFix * @author lzf */ function scrollFixed(obj1,obj2,obj3){ // obj1 涓哄瓙闆嗙殑鏍囩 // obj2 涓洪《閮ㄥ灞傜殑鐩掑瓙 // obj3 涓哄簳閮ㄦ粦鍔ㄥ埌浣嶇疆鐨勭洅瀛愮殑class锛屼笉鏄寘鍚墍鏈夌洅瀛愮殑澶栧眰 var arr1 = []; var i = 0; var md = $(obj1); //鑾峰彇涓嬮潰瀵瑰簲鐨勬瘡鍧楀唴瀹硅窛绂婚《閮ㄧ殑璺濈锛屾斁鍦ㄤ竴涓暟缁勯噷闈 $(window).load(function(){ $(obj3).each(function(){ var pos = $(this).offset().top; arr1.push(pos); }) }) var navOffsetTop=$(obj2).offset().top; var navOffsetH=$(obj2).innerHeight(); //涓婅竟灏忔寜閽殑鐐瑰嚮浜嬩欢 md.each(function(num,val){ $(md[num]).click(function(){ $("html,body").stop(true,true).animate({scrollTop:(arr1[num]-navOffsetH-80)+"px"}, 600); //update(); }) }); function update(){ var scrollH = $(window).scrollTop(); //婊氬姩椤堕儴鍥哄畾 if(scrollH>navOffsetTop+90){ $(obj2).css({"position":"fixed","top":"90px"}) }else{ $(obj2).css({"position":"relative","top":"auto"}) } //婊氬姩瀵艰埅楂樹寒鍒囨崲 for(var num =0; num\n"; strVar += "<\/div>\n"; strVar += "
\n"; strVar += "
\n"; strVar += "