window.onload=function(){ setinterval(function(){ if(!$("#index-1").hasclass("select-index")) $(".titled").removeclass("selected_titled"); else { settimeout(function(){ $(".titled").addclass("selected_titled"); },2000); } },0); } $(function(){ //location.replace("index.html#banner-1"); var len=$(".banner-ul li").length; //===================================banner 右边圆点点击================================================= $(".span-index p a").click(function(){ if(!$("html,body").is(":animated")) { $(this).addclass("select-index").parent().siblings().find("a").removeclass("select-index"); $("html,body").animate({ scrolltop:$($(this).attr("href")).offset().top + "px"},1000); } }); var i; var scrollfunc = function (e) { i = $(".select-index").attr("id").substr(-1); //alert(i); e = e || window.event; if (e.wheeldelta) { //判断浏览器ie,谷歌滑轮事件 if (e.wheeldelta > 0) { //当滑轮向上滚动时 if(i>1 && !$("html,body").is(":animated")) { i--; if(i==3){ i--; } $("#index-"+i).addclass("select-index").parent().siblings().find("a").removeclass("select-index"); $("html,body").animate({ scrolltop:$("#banner-"+i).offset().top + "px"},1000); } } if (e.wheeldelta < 0) { //当滑轮向下滚动时 if(i 0) { //当滑轮向上滚动时 if(i>1 && !$("html,body").is(":animated")) { i--; if(i==3){ i--; } $("#index-"+i).addclass("select-index").parent().siblings().find("a").removeclass("select-index"); $("html,body").animate({ scrolltop:$("#banner-"+i).offset().top + "px"},1000); } } if (e.detail< 0) { //当滑轮向下滚动时 if(i