/***********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:'1100px'},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"); } }) })