$(function(){ //活动排序 $(".main3 .post-31 ul li.news").each(function(){ //var time=$(this).find(".t1 span").text().split("日")[0]; //var month=time.split("月")[0]; //var day=time.split("月")[1]; //month<10?month="0"+month:month; //day<10?day="0"+day:day; //var time2=time.split("月")[0]+time.split("月")[1]; var date=$(this).attr("artdate").split(" ")[0] var time=$(this).attr("artdate").split(" ")[1] var time2=date.split("-")[0]+date.split("-")[1]+date.split("-")[2]+time.split(":")[0]+time.split(":")[1]+time.split(":")[2] $(this).attr("time",time2) }) var arrdiv=document.queryselectorall(".main3 .post-31 ul li.news") var arr=[]; for(i=0;i-1){ if(_href.split("c")[1].split("a")[0]==_pathname){$(this).parents("li").addclass("noclick");} }else{ $(this).parents("li").addclass("noclick"); } }) var myswiper = new swiper('.swiper-31',{ scrollbar:'.swiper-scrollbar', prevbutton:'.post-31 .swiper-button-prev', nextbutton:'.post-31 .swiper-button-next', slidesperview:4, breakpoints: { //当宽度小于等于 1455: { slidesperview: 3, }, 1000: { slidesperview: 2, }, 767: { slidesperview: 1, }, } }); //媒体视角 $(".main5 .post-51 ul li.news .news_imgs img").each(function(){ if($(this).attr("src")==""){$(this).attr("src","/_upload/tpl/00/ad/173/template173/images/defaultimg.png")} }) //文化工二大wap var html1=$(".post-61>ul").clone(); var html2=$(".post-62>ul").clone(); var html3=$(".post-64").clone(); var html4=$(".p631-con").clone(); var html5=$(".post-65").clone(); var html6=$(".p632-con").clone(); $(".wrap_1").html(html1) $(".wrap_2").html(html2) $(".wrap_3").html(html3) $(".wrap_4").html(html4) $(".wrap_5").html(html5) $(".wrap_6").html(html6) if($(window).width()<1000){ $(".main6 .wap_culture .post-65 ul li.news .news_text").html("

浦江畔,东海滨

神州学子沐朝阳

...

") $(".wap_culture .wrap_1 .news_imgs img").attr("src","/_upload/tpl/00/ad/173/template173/images/wap-xiaoxun.svg") } if ($(window).width() <1000) { $(".foot-center").after($(".foot-left")) } if ($(window).width() <480) { //判断缩放生效的显示器分辨率临界值 $('.main5').remove(); //在对应的类名添加缩放样式 } if($(window).width()<=500){ $('.post-63').prependto('.post-60 .mr') $('.post-62').prependto('.post-60 .mr') //$('.post-65').appendto('.post-60 .con ') /* $(".main3 .post-31 ul").slick({ dots: false, //指示点 infinite: true, //循环播放 autoplay: true, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 , //幻灯片每次滑动个数 }); */ } /*主大图切换*/ $(".mbanner .news_list").slick({ dots: true, //指示点 infinite: true, //循环播放 autoplay: true, //自动播放 autoplayspeed: 2000, //自动播放间隔 arrows: false, //左右箭头 fade: true, pauseonhover: false, usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 , //幻灯片每次滑动个数 responsive: [ { breakpoint: 500, settings: { dots: false, arrows: true, } }, ], }); $(".main1 .post-12 ul li.news").each(function () { var a1=$(this).find("a").attr("href") var a2=$(".main1 .post-11 ul li.news .news_imgs a").attr("href") if(a1==a2){ $(this).remove(); } }) var t12=$(".post-12 .news_list").children().length; //console.log(t12); if(t12>5){ $(".main1 .post-12 ul li.news.n6").remove(); } $(".main5 .post-51 ul li.news,.main5-1 .post-51 ul li.news").each(function() { var t1=$(this).find(".news_title").text().split(":")[0]; $(this).find(".news_tt span").text(t1) if(t1.indexof("中国新闻网")>-1){ $(this).find(".news_tt").addclass("t1") } if(t1.indexof("青春上海")>-1){ $(this).find(".news_tt").addclass("t2") } if(t1.indexof("人民日报")>-1){ $(this).find(".news_tt").addclass("t3") } if(t1.indexof("光明日报")>-1){ $(this).find(".news_tt").addclass("t4") } if(t1.indexof("学习强国")>-1){ $(this).find(".news_tt").addclass("t5") } if(t1.indexof("中国教育报")>-1){ $(this).find(".news_tt").addclass("t6") } if(t1.indexof("解放日报")>-1){ $(this).find(".news_tt").addclass("t7") } if(t1.indexof("上观新闻")>-1){ $(this).find(".news_tt").addclass("t8") } if(t1.indexof("文汇报")>-1){ $(this).find(".news_tt").addclass("t9") } if(t1.indexof("文汇app")>-1){ $(this).find(".news_tt").addclass("t10") } if(t1.indexof("上视新闻综合频道")>-1){ $(this).find(".news_tt").addclass("t11") } if(t1.indexof("东方财经电视台")>-1){ $(this).find(".news_tt").addclass("t12") } if(t1.indexof("上海教育新闻网")>-1){ $(this).find(".news_tt").addclass("t13") } if(t1.indexof("上海科技报")>-1){ $(this).find(".news_tt").addclass("t14") } if(t1.indexof("话匣子app")>-1){ $(this).find(".news_tt").addclass("t15") } if(t1.indexof("东方网")>-1){ $(this).find(".news_tt").addclass("t16") } if(t1.indexof("澎湃新闻")>-1){ $(this).find(".news_tt").addclass("t17") } if(t1.indexof("新民晚报")>-1){ $(this).find(".news_tt").addclass("t18") } if(t1.indexof("青年报")>-1){ $(this).find(".news_tt").addclass("t19") } if(t1.indexof("劳动报")>-1){ $(this).find(".news_tt").addclass("t20") } if(t1.indexof("劳动观察")>-1){ $(this).find(".news_tt").addclass("t21") } if(t1.indexof("shanghai daily")>-1){ $(this).find(".news_tt").addclass("t22") } if(t1.indexof("周到上海")>-1){ $(this).find(".news_tt").addclass("t23") } if(t1.indexof("上海教育电视台")>-1){ $(this).find(".news_tt").addclass("t25") } if(t1.indexof("上海发布")>-1){ $(this).find(".news_tt").addclass("t26") } if(t1=="上海教育"){ $(this).find(".news_tt").addclass("t27") } if(t1.indexof("上海智慧党建")>-1){ $(this).find(".news_tt").addclass("t28") } if(t1.indexof("东方教育时报")>-1){ $(this).find(".news_tt").addclass("t29") } if(t1.indexof("第一教育")>-1){ $(this).find(".news_tt").addclass("t30") } if(t1.indexof("浦东时报")>-1){ $(this).find(".news_tt").addclass("t31") } if(t1.indexof("浦东发布")>-1){ $(this).find(".news_tt").addclass("t32") } if(t1.indexof("浦东电视台")>-1){ $(this).find(".news_tt").addclass("t33") } if(t1.indexof("央广网")>-1){ $(this).find(".news_tt").addclass("t34") } if(t1.indexof("阳光校园")>-1){ $(this).find(".news_tt").addclass("t35") } if(t1.indexof("中国青年报")>-1){ $(this).find(".news_tt").addclass("t36") } }) /* $(".main8 .shares li.i4 a").attr("href","https://www.weibo.com/u/2315199241"); $(".main8 .shares li.i6 a").attr("href","https://space.bilibili.com/526438471?spm_id_from=333.337.0.0"); $(".main8 .shares li.i1 a").attr("href","javascript:void(0);"); $(".main8 .shares li.i2 a").attr("href","javascript:void(0);"); $(".main8 .shares li.i4 a").attr("href","javascript:void(0);"); $(".main8 .shares li.i5 a").attr("href","javascript:void(0);"); */ $(".main9 .post-91 ul li.news.n8").hover(function() { $(".main9 .ztbdcont").show(); },function(){ $(".main9 .ztbdcont").hide(); }) $(".main9 .ztbdcont").hover(function(){ $(this).show(); },function(){ $(this).hide(); }) var _ref=$(".main6 .post-65 ul li.news .news_title a").attr("href") $(".wrap_a").attr("href",_ref) /* $(".post-72 .news_list").slick({ dots: true, //指示点 infinite: false, //循环播放 autoplay: true, //自动播放 autoplayspeed: 3000, //自动播放间隔 arrows: false, //左右箭头 usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 4, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 }); */ $(".post-72 .news_list").on("init", function(event, slick) { /*console.log($(this))*/ $(".post-72 .news_list li.news").removeclass("slick-end"); $(this).find(" li.news.slick-active").last().addclass("slick-end"); }); $(".post-21 .more-link .moretext").text("查看更多") $(".slick-dots li button").each(function(){ var t1=$(this).text(); if(t1<10){ t1='0'+t1; } $(this).text(t1); }) /*$(".post-11 .news_list").slick({ dots: true, //指示点 infinite: true, //循环播放 autoplay: true, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: false, //左右箭头 fade: true, usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 });*/ /*$(".post-41 .news_list").slick({ dots: false, //指示点 infinite: true, //循环播放 autoplay: false, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 centermode: true, usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 3, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 });*/ $(".post-51 .ul1").slick({ dots: false, //指示点 infinite: false, //循环播放 autoplay: false, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 }); $(".post-51 .ul2").slick({ dots: false, //指示点 infinite: false, //循环播放 autoplay: false, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 }); $(".post-51 .ul3").slick({ dots: false, //指示点 infinite: false, //循环播放 autoplay: false, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 1, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 }); $(".main5 .post-51 .ul2 .slick-prev").click(function(){ $(".main5 .post-51 .ul1 .slick-prev").click(); $(".main5 .post-51 .ul3 .slick-prev").click(); }) $(".main5 .post-51 .ul2 .slick-next").click(function(){ $(".main5 .post-51 .ul1 .slick-next").click(); $(".main5 .post-51 .ul3 .slick-next").click(); }) /*var myswiper = new swiper('.post-81 .swiper-container',{ initialslide :0, slidesperview : 'auto', prevbutton:'.swiper-prev', nextbutton:'.swiper-next', })*/ $(".post-71 .news_list").slick({ dots: false, //指示点 infinite: true, //循环播放 autoplay: true, //自动播放 autoplayspeed: 5000, //自动播放间隔 arrows: true, //左右箭头 fade: true, usecss: true, //使用 css3 过度 speed: 600, //滑动时间 slide: 'li', //滑动元素查询 slidestoshow: 3, //幻灯片每屏显示个数 slidestoscroll: 1 //幻灯片每次滑动个数 }); /*新闻tab切换*/ $(".post-31").sudytab({ handle:".ul2 .news", content:".ul1 .news", trigger:"mouseenter", start:1, autoplay:{ active:false } }); $(".post-52").sudytab({ handle:".tab-tt .title", content:".tab-con .boxm", trigger:"mouseenter", start:1, autoplay:{ active:false } }); $(".body_home").addclass("showdiv"); /*刷新自动回顶*/ $("html,body").animate({ scrolltop: 0, screenleft: 0, }, 400); $(".post-21").sudytab({ handle:".tit .title", content:".con .boxm,.more_btn .more_text", trigger:"mouseenter", start:1, autoplay:{ active:false } }); //手指滑动 let startx = 0;let starty = 0;document.queryselector(".body_home").addeventlistener('touchstart',(e) => { //e.preventdefault(); startx = e.changedtouches[0].pagex;starty = e.changedtouches[0].pagey;},false,); document.queryselector(".body_home").addeventlistener('touchmove',(e) => { //e.preventdefault(); let moveendx = e.changedtouches[0].pagex;let moveendy = e.changedtouches[0].pagey;var x = moveendx - startx;var y = moveendy - starty; if (math.abs(x) > math.abs(y) && x > 0) { console.log('right'); } else if (math.abs(x) > math.abs(y) && x < 0) { console.log('left'); } else if (math.abs(y) > math.abs(x) && y > 0) { console.log('bottom'); } else if (math.abs(y) > math.abs(x) && y < 0) { $(".bb").click(); } else { //alert('just touch'); } },false) //内容滑动 let startx2 = 0;let starty2 = 0; document.queryselector(".main_wrap").addeventlistener('touchstart',(e) => { //e.preventdefault(); startx2 = e.changedtouches[0].pagex;starty2 = e.changedtouches[0].pagey;},true); document.queryselector(".main_wrap").addeventlistener('touchmove',(e) => { //e.preventdefault(); let moveendx = e.changedtouches[0].pagex;let moveendy = e.changedtouches[0].pagey;var x = moveendx - startx2;var y = moveendy - starty2; if (math.abs(x) > math.abs(y) && x > 0) { console.log('right'); } else if (math.abs(x) > math.abs(y) && x < 0) { console.log('left'); } else if (math.abs(y) > math.abs(x) && y > 0) { console.log("下移动") if($(".main_wrap").scrolltop()==0){ console.log("顶部移动") $(".body_home").addclass("showdiv"); $(".main1,.main2").removeclass("showdiv"); $(".topbox").removeclass("showdiv"); $(".body_b").removeclass("showdiv"); if($(".body_b").css("position")=="fixed")$(".header").removeclass("mobile"); } } else if (math.abs(y) > math.abs(x) && y < 0) { console.log('top'); } else { //alert('just touch'); } },true) //页面滚动 //$(".main_wrap").animate({"scrolltop":$(".main_wrap").find(_id).offset().top + $(".main_wrap").scrolltop()-hdheight},600) $(".sidenav-menu>div").click(function(){ var hdheight=$(".body_b #header").height() var _id="#container-"+$(this).attr("address"); $(this).addclass("selected").siblings().removeclass("selected") $(".main_wrap").scrolltop($(".main_wrap").find(_id).offset().top + $(".main_wrap").scrolltop()-hdheight); }) if($(window).width()>480){ $(".main_wrap").mousewheel(function(event, delta, deltax, deltay){ if(deltay>0){ } if(deltay<0){ //$(".topbox").addclass("showdiv"); if($(".main2").hasclass("showdiv")){ //$(".topbox").addclass("showdiv"); } } if(delta>0 && $(".main_wrap").scrolltop()==0){ $(".body_home").addclass("showdiv"); $(".main1,.main2").removeclass("showdiv"); $(".topbox").removeclass("showdiv"); settimeout(function(){ if($(window).width()>850){ } },500); $(".body_b").removeclass("showdiv"); if($(".body_b").css("position")=="fixed")$(".header").removeclass("mobile"); } }); $(".bb").click(function(){ $(".body_home").css("zindex","100"); $(".body_b").addclass("showdiv");//.focus(); //$(".topbox").addclass("showdiv"); $(".body_b").focus() settimeout(function(){ $(".body_home").removeclass("showdiv");//.addclass("leave"); $(".home5").addclass("showdiv"); $(".main1,.main2").addclass("showdiv"); $(".body_b").focus() $(".topbox").addclass("showdiv"); },500); }) $(".body_home").mousewheel(function(event, delta, deltax, deltay){ if(delta<0){ $(".bb").click(); }; }); if($(".body_home").hasclass("showdiv")){ $(".main_wrap").mousewheel(function(event, delta, deltax, deltay){ if(delta<0){ $(".bb").click(); }; }); } } $('body').keydown(function(e){ if(e.keycode=="40" && $(".body_home").hasclass("showdiv")){ $(".bb").click(); } if(e.keycode=="38" && $(".body_b").hasclass("showdiv") && $(".body_b").scrolltop()==0){ $(".body_home").addclass("showdiv"); $(".main1").removeclass("showdiv"); $(".topbox").removeclass("showdiv"); settimeout(function(){ if($(window).width()>850){ } },500); $(".body_b").removeclass("showdiv"); if($(".body_b").css("position")=="fixed")$(".header").removeclass("mobile"); } if (e.keycode=="40" && $(".topbox").hasclass("showdiv")) { var scrollheight = $('.body_b').scrolltop(); $('.body_b').scrolltop(scrollheight + 10); } if (e.keycode=="38" && $(".topbox").hasclass("showdiv")) { var scrollheight = $('.body_b').scrolltop(); $('.body_b').scrolltop(scrollheight - 10); } }) /*动画*/ var main4fix=$(window).height()*6*0.01; //$(".main4").attr("fix",main4fix) $(".main_wrap").scroll(function(){ $(".main1,.main2,.main3,.main4,.main5,.main8,.main9").each(function(index, element) { var e=$(this); var fix=parseint(e.attr("fix"));console.log(fix) if(!fix && fix!=0){fix=$(window).height()*6*0.08;} //else{fix=$(window).height()*fix*0.1;} if($(window).scrolltop()>=$(e).offset().top-fix){ if(!$(e).hasclass("showdiv")){ //$(e).addclass("showdiv"); } $(".sidenav-menu>div").eq(index).addclass("selected").siblings().removeclass("selected") } else{ if($(e).hasclass("showdiv")){ //$(e).removeclass("showdiv"); } } }); }); if($(window).width()>999){ $(".main_wrap").scroll(function(){ $(".main1,.main2,.main3,.main4,.main5,.main6,.wp7-8,.main7,.main8,.main9,.main10").each(function(index, element) { var e=$(this); var fix=parseint(e.attr("fix")); if(!fix && fix!=0){fix=$(window).height()*6*0.2;} else{fix=$(window).height()*fix*0.2;} if($(window).scrolltop()>=$(e).offset().top-fix){ if(!$(e).hasclass("showdiv")){ $(e).addclass("showdiv"); } } else{ if($(e).hasclass("showdiv")){ $(e).removeclass("showdiv"); } } }); }); }else{ $(window).scroll(function(){ $(".main1,.main2,.main3,.main4,.main5,.main5-1,.main6,.wp7-8,.main7,.main8").each(function(index, element) { var e=$(this); var fix=parseint(e.attr("fix")); if(!fix && fix!=0){fix=$(window).height()*6*0.15;} else{fix=$(window).height()*fix*0.15;} if($(window).scrolltop()>=$(e).offset().top-fix){ if(!$(e).hasclass("showdiv")){ $(e).addclass("showdiv"); } } else{ if($(e).hasclass("showdiv")){ $(e).removeclass("showdiv"); } } }); }); } var svg1=new vivus("svg1",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg2=new vivus("svg2",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg3=new vivus("svg3",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg4=new vivus("svg4",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg5=new vivus("svg5",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg6=new vivus("svg6",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg7=new vivus("svg7",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg8=new vivus("svg8",{ type:'delayed', duration:80, start:'autostart', delay:50 }); var svg9=new vivus("svg9",{ type:'delayed', duration:80, start:'autostart', delay:50 }); $("#svg1").mouseenter(function(){ svg1.reset().play(function(){console.log(1)}); }) $("#svg2").mouseenter(function(){ svg2.reset().play(function(){console.log(1)}); }) $("#svg3").mouseenter(function(){ svg3.reset().play(function(){console.log(1)}); }) $("#svg4").mouseenter(function(){ svg4.reset().play(function(){console.log(1)}); }) $("#svg5").mouseenter(function(){ svg5.reset().play(function(){console.log(1)}); }) $("#svg6").mouseenter(function(){ svg6.reset().play(function(){console.log(1)}); }) $("#svg7").mouseenter(function(){ svg7.reset().play(function(){console.log(1)}); }) $("#svg8").mouseenter(function(){ svg8.reset().play(function(){console.log(1)}); }) $("#svg9").mouseenter(function(){ svg9.reset().play(function(){console.log(1)}); }) ; });