index.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. $(function(){
  2. // 头条资讯 轮播
  3. jQuery(".InvestBox_slide").slide({titCell:".hd ul",mainCell:".slide_main ul",autoPage:true,autoPlay:false,effect:"left",trigger:"click",interTime:5000});
  4. $('.InvestBox_slide .hd ul li').html('');
  5. var obj= new Object();
  6. obj.page=1; //页码
  7. obj.limit=6; //条数
  8. obj.upload=0; //用于更多加载问题
  9. $('.listTop_nav a').on('click',function(){
  10. $(this).addClass('on').siblings().removeClass('on');
  11. obj.name=$(this).attr('data-name');
  12. obj.type=$(this).attr('data-type');
  13. if(obj.type == 1){
  14. $('.listTop_nav_lst').animate({height:"38px"},300);
  15. $('.listTop_nav_lst').show();
  16. NavAjax();
  17. }else{
  18. obj.id =0;
  19. listAjax();
  20. $('.listTop_nav_lst').hide()
  21. $('.listTop_nav_lst').animate({height:"0px"},300);
  22. }
  23. })
  24. $('.listTop_nav a').eq(0).click();
  25. $('.listTop_nav_lst').on('click','a',function(){
  26. $(this).addClass('on').siblings().removeClass('on');
  27. obj.id=$(this).attr('data-id');
  28. obj.page=1;
  29. listAjax();
  30. })
  31. function NavAjax(){
  32. var _nav=''
  33. $.ajax({
  34. url:'/investhot/city',
  35. type:'get',
  36. data:{name:obj.name,type:obj.type,page:1,limit:10},
  37. dataType:"json",
  38. success:function(data){
  39. $('.listTop_nav_lst').html('');
  40. if(data.code == 200){
  41. $.each(data.data,function(i,v){
  42. _nav+='<a href="javascript:;" data-id="'+v.id+'"><span>'+v.city_name+'</span></a>'
  43. })
  44. $('.listTop_nav_lst').html(_nav);
  45. $('.listTop_nav_lst a').eq(0).click();
  46. }
  47. }
  48. });
  49. }
  50. function listAjax(){
  51. var _list=''
  52. $.ajax({
  53. url:'/investhot/getlistdata',
  54. type:'get',
  55. data:{name:obj.name,city:obj.id,type:obj.type,page:obj.page,limit:obj.limit},
  56. dataType:"json",
  57. success:function(data){
  58. $('.center_list ul').html('');
  59. if(data.code == 200){
  60. $.each(data.data,function(i,v){
  61. _list+='<li>';
  62. _list+='<a target="_blank" href="'+v.url+'">';
  63. _list+='<p class="img">';
  64. _list+='<span><img src="http://qwimg.qianwuwang.com/pc/special/'+v.img+'" alt=""></span>';
  65. if ( i <= 2 ) {
  66. _list+='<i><img src="/image/investhot/m_in_ico1.png" alt=""></i>';
  67. }else if ( i > 2 && v.is_push == 2) {
  68. _list+='<i><img src="/image/investhot/m_in_ico2.png" alt=""></i>';
  69. }
  70. _list+='</p>';
  71. _list+='<div class="text">';
  72. _list+='<p>'+v.title+'</p>';
  73. // _list+='<p>详细介绍文字或宣传文字'+v.id+'</p>';
  74. _list+='</div>';
  75. _list+='</a>';
  76. _list+='</li>';
  77. })
  78. // console.log(obj.upload)
  79. if(obj.upload == 0){
  80. $('.center_list ul').html(_list);
  81. // console.log(obj.upload)
  82. }else if(obj.upload == 180){
  83. $('.center_list ul').append(_list);
  84. // console.log(obj.upload)
  85. }
  86. // console.log(obj.upload)
  87. }else if(data.code == 300){
  88. $('.more_zt a').addClass('on')
  89. $('.more_zt a').find('span').html('收起')
  90. }
  91. }
  92. });
  93. }
  94. $('.more_zt a').on('click',function(){
  95. obj.page++;
  96. obj.upload = 180;
  97. if($(this).hasClass('on')){
  98. obj.page=1;
  99. obj.upload =0;
  100. $('.more_zt a').removeClass('on');
  101. $('.more_zt a').find('span').html('更多')
  102. }
  103. listAjax();
  104. })
  105. $('.listMain ul li').hover(function (){
  106. $(this).find('.shoue_in').animate({bottom:"0px"},300);
  107. $(this).find('.title_l').fadeOut(80);
  108. },function (){
  109. $(this).find('.shoue_in').animate({bottom:"-100%"},300);
  110. $(this).find('.title_l').fadeIn(80);
  111. });
  112. // $('.bottom_text').on('click','a.tuily',function(){
  113. // if($(this).hasClass('on')){ //判断css on 是否存在
  114. // $(this).parent().parent().find('.xianghis').fadeOut(80);
  115. // $(this).removeClass('on');
  116. // }else{
  117. // $(this).parent().parent().find('.xianghis').fadeIn(80);
  118. // $(this).addClass('on');
  119. // }
  120. // })
  121. $(".bottom_text a.tuily").hover(function(){
  122. $(this).parent().parent().find('.xianghis').fadeIn(80);
  123. $(this).addClass('on');
  124. },function(){
  125. $(this).parent().parent().find('.xianghis').fadeOut(80);
  126. $(this).removeClass('on');
  127. });
  128. })