/***********naive下拉**************/ $(document).ready(function(){ $('.nav-lev span').click(function(){ $(".lev2").not($(this).parents(".nav-lev").find(".lev2")).css("display","none"); $(this).parents(".nav-lev").find(".lev2").slidetoggle(); }); }); /////////////////////* $(document).ready(function(){ $(".nav-lev").click(function(){ $(this).addclass("hover").siblings().removeclass("hover"); }); }); /************/ $(document).ready(function(){ $(".nav-bar").click(function(){ $(".nav-bg").stop().animate({width:'100%',height:'700px'},700) $(".v_close").fadein() $(this).fadeout() $(".v_close").click(function(){ $(".nav-bg").stop().animate({width:'0px',height:'0px'},700) $(".nav-bar").fadein() $(this).fadeout() $(this).parents(".nav-bg").find(".hover").removeclass("hover"); $(this).parents(".nav-bg").find(".lev2").css("display","none"); }); }); }); /******************/ // 选项卡 function changebg(tar) { if (tar.classname == "btn-off") { $(".btn-on").attr("class","btn-off"); $(".btn-in2").attr("style","display:none"); $("#"+tar.id).attr("class","btn-on"); $("#it"+tar.id).attr("style","display:block"); } } /*vidio*****************************************/ $(document).ready(function(){ $(".sp-btn").click(function(){ $(this).parents(".spin").find(".sp_show_bg").css("display","block") $(".v_close").click(function(){ $(this).parents(".spin").find(".sp_show_bg").css("display","none") }); }); }); /******锚链接*****/ (function($){ $.extend($.fn,{ scrollto:function(time,to){ time=time||800; to=to||1; $('a[href*=#]', this).click(function(){ if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { if (to == 1) { $('html,body').animate({ scrolltop: $target.offset().top }, time); } else if(to==2){ $('html,body').animate({ scrollleft: $target.offset().left }, time); }else{ alert('argument error!'); } return false; } } }); } }); })(jquery); /////悬浮顶部/////// $(document).ready(function(){ var headheight=260; var nav=$("#ks-tab"); $(window).scroll(function(){ if($(this).scrolltop()>headheight){ nav.addclass("navfix"); } else{ nav.removeclass("navfix"); } }) })