index.min.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // 首页日期
  2. function getWeek(dateString) {
  3. var day = new Date(Date.parse(dateString));
  4. var today = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
  5. var week = today[day.getDay()];
  6. return week;
  7. };
  8. function indexDateF(){
  9. $('.zhibolist .datedd').remove();
  10. function tDou(n){
  11. return n>9? n: "0"+n;
  12. }
  13. function GetDateStr(AddDayCount) {
  14. var dd = new Date();
  15. dd.setDate(dd.getDate()+AddDayCount);
  16. var y = dd.getFullYear();
  17. var m = tDou(dd.getMonth()+1);
  18. var d = tDou(dd.getDate());
  19. return [y+"-"+m+"-"+d,m,d,y];
  20. }
  21. for(i=-1;i<10;i++){
  22. var str=GetDateStr(i)[0];
  23. var m=GetDateStr(i)[1];
  24. var d=GetDateStr(i)[2];
  25. var y=GetDateStr(i)[3];
  26. if($('.zhibolist li[data-matchtime^='+str+']').length>0){
  27. var oDHtml="<p class='charutime'><cite>"+y+"-"+m+"-"+d+"</cite><em>"+ getWeek(GetDateStr(i)[0]) +"</em></p>";
  28. $('.zhibolist li[data-matchtime^='+str+']').eq(0).before(oDHtml);
  29. }
  30. }
  31. }
  32. indexDateF();
  33. //首页滑动
  34. window.onload = function() {
  35. var navSwiper = new Swiper('#header', {
  36. freeMode: true,
  37. slidesPerView: 'auto',
  38. freeModeSticky: true,
  39. });
  40. }
  41. $(function(){
  42. var dqwzsy=$(".on").index("#header .swiper-wrapper li a")
  43. if(dqwzsy >5){
  44. $("#header .swiper-wrapper").css({
  45. "transform": "translate3d(-124px, 0px, 0px)",
  46. "transition-duration": "0ms"
  47. })
  48. }
  49. })
  50. //首页筛选
  51. $('.index_z_caid_shaixuan').click(function(){
  52. $('.mark_wrap').show();
  53. $('body').css('overflow','hidden');
  54. $('body').css('position','fixed');
  55. });
  56. $('.sx_con_wrap_cos').click(function(){
  57. $('.mark_wrap').hide();
  58. $('body').css('overflow','auto');
  59. $('body').css('position','static');
  60. });
  61. // 首页分类点击切换
  62. $('.index_z_caid li').click(function(){
  63. var oIndex=$(this).index();
  64. $('.index_z_caid_wrap .top-event-type li').eq(oIndex).addClass('flhover').siblings('li').removeClass('flhover');
  65. $('.index_z_caid_wrap .index_z_caid li').eq(oIndex).addClass('flhover').siblings('li').removeClass('flhover');
  66. var oType=$(this).attr("data-type");
  67. $('.top-event-type').attr('data-type',oType);
  68. if(oType==0){
  69. $('.index_zhibo_wrap li').show();
  70. $(".index_zhibo_wrap li.datedd").show();
  71. }else if(oType>0){
  72. $(".index_zhibo_wrap li.datedd").hide()
  73. $('.index_zhibo_wrap li').each(function(i){
  74. if($('.index_zhibo_wrap li').eq(i).attr("data-type")==oType){
  75. $('.index_zhibo_wrap li').eq(i).show();
  76. $('.index_zhibo_wrap li').eq(i).prevAll('.datedd').eq(0).show();
  77. }else{
  78. $('.index_zhibo_wrap li').eq(i).hide();
  79. }
  80. })
  81. }else if(oType<5){
  82. $('.index_zhibo_wrap li').each(function(i){
  83. if($('.index_zhibo_wrap li').eq(i).attr("is_important")==1){
  84. $('.index_zhibo_wrap li').eq(i).show();
  85. $('.index_zhibo_wrap li').eq(i).prevAll('.datedd').eq(0).show();
  86. }else{
  87. $('.index_zhibo_wrap li').eq(i).hide();
  88. }
  89. })
  90. }
  91. })
  92. //首页切换
  93. $('.za_n_ua_wrap_top ').children("li").each(function(index, element) {
  94. $(this).click(function() {
  95. $(this).addClass('za_n_ua_wrap_top_cor').siblings().removeClass('za_n_ua_wrap_top_cor')
  96. $($(".tab").children()[index]).css("display", "block")
  97. $($(".tab").children()[index]).siblings().css("display", "none")
  98. })
  99. })