$(function(){ /*默认切换*/ $("body").sudyTab({ handle:".navcon .item", // 控制器元素,默认.tab-menu li content:".mainbox td>.maincon", // 内容体,可以有多个并以英文,号隔开,如.tab-list li,.tab-more li,默认值为".tab-list li,.tab-more li" rule:".mainbox .mod", // 排除内容体,可以有多个并以英文,号隔开,如.tab-list li,.tab-more li,默认值为".tab-list li,.tab-more li" trigger:"mouseenter", // 触发事件,默认为"mouseenter"鼠标经过 start:2, // 开始项,默认为第一 out:2, // 排除项,默认为第1 autoPlay:{ active:false, // 是否激活自动切换 interval:5000, // 自动切换时间间隔 pauseHover:true // 是否鼠标放上面时停止自动 } }); /*相关教师数据*/ //getRelateData(); if($(window).width()<768){ /*移动-导航切换*/ $("body").sudyTab({ handle:".navi-aside-wrap .navcon .item", content:".mainbox .maincon", rule:".mainbox .mod", trigger:"mouseenter", start:1, out:2, autoPlay:{ active:false, interval:5000, pauseHover:true }, callback:function(index){ //if(index!==4){ var that = this; if(!$(this).data("tabed")){ setTimeout(function(){ var id = 'wrapperinner-tab-'+index; $(that).data("tabed", true); $(that).find(".news_table").each(function(i, table){ if(!(index==4&&i!==0&&i!==3)){ var ids = id+'-'+i; $wrapper = $('
'); $scroller = $('
'); $(table).wrap($wrapper); $(table).wrap($scroller); var resultContentH = $(table).height(); $("#"+ids).height(resultContentH+2); var scroller = new IScroll("#"+ids, { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false }); setTimeout(function(){ scroller.refresh(); },0); $(table).data("scroller", scroller); } }); },10); }else{ $(that).find(".news_table").each(function(i, table){ var scroller = $(table).data("scroller"); if(scroller){ scroller.refresh(); } }); } //} } }); /*移动-默认显示第一个*/ $(".navcon .item").eq(0).trigger("mouseenter"); /*移动-输出表格信息中第一个*/ $(".new_tabs.tabs1").eq(0).sudyTab({ handle:".tab_menu .item", content:".tabs_box .tabs_con", trigger:"mouseenter", start:1, autoPlay:{ active:false, interval:5000, pauseHover:true }, callback:function(index){ if(index!==0){ var that = this; if(!$(this).data("tabed")){ setTimeout(function(){ var id1 = 'wrapperinner-tab4-'+index; $(that).data("tabed", true); $(that).find(".news_table").each(function(i, table){ var ids = id1+'-'+i; $wrapper = $('
'); $scroller = $('
'); $(table).wrap($wrapper); $(table).wrap($scroller); var resultContentH = $(table).height(); $("#"+ids).height(resultContentH+2); var scroller = new IScroll("#"+ids, { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false }); setTimeout(function(){ scroller.refresh(); },0); $(table).data("scroller", scroller); }); },10); }else{ $(that).find(".news_table").each(function(i, table){ var scroller = $(table).data("scroller"); if(scroller){ scroller.refresh(); } }); } } } }); /*移动-输出表格信息中第二个*/ $(".new_tabs.tabs1").eq(1).sudyTab({ handle:".tab_menu .item", content:".tabs_box .tabs_con", trigger:"mouseenter", start:1, //默认第3个 autoPlay:{ active:false, interval:5000, pauseHover:true }, callback:function(index){ if(index!==0){ var that = this; if(!$(this).data("tabed")){ setTimeout(function(){ var id1 = 'wrapperinner-tab5-'+index; $(that).data("tabed", true); $(that).find(".news_table").each(function(i, table){ var ids = id1+'-'+i; $wrapper = $('
'); $scroller = $('
'); $(table).wrap($wrapper); $(table).wrap($scroller); var resultContentH = $(table).height(); $("#"+ids).height(resultContentH+2); var scroller = new IScroll("#"+ids, { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false }); setTimeout(function(){ scroller.refresh(); },0); $(table).data("scroller", scroller); }); },10); }else{ $(that).find(".news_table").each(function(i, table){ var scroller = $(table).data("scroller"); if(scroller){ scroller.refresh(); } }); } } } }); }else{ /*默认显示*/ $(".new_tabs.tabs1,.new_tabs.tabs2").sudyTab({ handle:".tab_menu .item", content:".tabs_box .tabs_con", trigger:"mouseenter", start:1, autoPlay:{ active:false, interval:5000, pauseHover:true } }); } /*表格超过10行显示更多*/ $(".news_table").each(function(){ if($(this).find("tr").length>=11){ $(this).find("tr:gt(10)").addClass("none"); $(this).after('
显示更多
'); $(this).next(".news_more").on("click",function(){ $(this).prev().find("tr").removeClass("none"); $(this).remove(); }); } }); /*信息列表超过10行显示更多*/ $(".new_listcon .tabs_box").each(function(){ if($(this).find(".news").length>=11){ $(this).find("li:gt(10)").addClass("none"); $(this).after('
显示更多
'); $(this).next(".news_more").on("click",function(){ $(this).prev().find(".news").removeClass("none"); $(this).remove(); }); } }); }); /*二维码中间logo*/ function getImageUrl(){ //return "/_upload/tpl/00/07/7/template7/tplRes/images/logo.jpg"; } /*相关教师方法*/ function getRelateData() { var departmentname=$('#departmentName').val(); var teacherName=$('#teacherName').val(); var typeName =$('#typeName').val(); var typeId= typeName=='TEACHER_CN'?1:2; var conditdata = [ {field: "language", value: typeId, judge: "="}, {field: "published", value: "1", judge: '='}, {field: "department", value: departmentname, judge: '='}, {field : "title", value :teacherName, judge : "!="} ]; var returnInfodata = [ {field: "title", name: "title"}, {headerPic: "headerPic", name: "headerPic"}, {field: "cnUrl", name: "cnUrl"}, {field: "department", name: "department"}, {field: "degree", name: "degree"} ]; var conditions = JSON.stringify(conditdata); var returnInfos = JSON.stringify(returnInfodata); $.ajax({ url: "/_wp3services/generalQuery?queryObj=teacherHome", type: 'POST', async: false, contentType: "application/x-www-form-urlencoded; charset=utf-8", dataType: 'json', data: {pageIndex: 1, rows: 6, conditions: conditions, returnInfos: returnInfos, articleType: typeId, level: 0}, success: function(result) { setRelateData(result); } }); } function setRelateData(result) { var count = result.data.length; if (count > 3) { count = 3; } var html = ""; for (i = 0; i < count; i++) { var teacher = result.data[i]; var title = teacher.title; var department = teacher.department; var degree = teacher.degree; var tecUrl = teacher.cnUrl; var headerPic = teacher.headerPic; html += ''; } $(".teach_list").html(html); }