index.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. // 顶部检索栏
  2. $(window).scroll(function (){
  3. var st = $(this).scrollTop();
  4. if(st >10){
  5. $('.w_top').addClass('w-top-bg');
  6. }else{
  7. $('.w_top').removeClass('w-top-bg');
  8. }
  9. });
  10. //轮播图片
  11. var mySwiper1= new Swiper(".swiper-container1",{
  12. loop : true,
  13. loopedSlides:4,
  14. autoplay:5500,
  15. autoplayDisableOnInteraction : false,
  16. // 如果需要分页器
  17. pagination: '.swiper-pagination',
  18. slidesPerView :"auto"
  19. });
  20. var regIon= new Swiper(".swiper-container2",{
  21. loop : false,
  22. loopedSlides:4,
  23. pagination: '.swiper-pagination',
  24. autoplayDisableOnInteraction : false,
  25. slidesPerView :"auto"
  26. });
  27. // 品牌馆
  28. var mySwiper1= new Swiper("#yw_swiper_5",{
  29. loop : false,
  30. // autoplay:5500,
  31. slidesPerGroup : 2,
  32. autoplayDisableOnInteraction : false,
  33. slidesPerView :"auto"
  34. });
  35. // 专题入口
  36. new Swiper(".wner",{
  37. slidesPerView :'auto',
  38. pagination:'.wner-list',
  39. spaceBetween:10,
  40. // initialSlide:1,
  41. effect:'coverflow',
  42. centeredSlides: true,
  43. coverflow: {
  44. rotate: 30,
  45. stretch: 10,
  46. depth:20,
  47. modifier: 1,
  48. slideShadows : true
  49. }
  50. });
  51. // 品房头条
  52. function autoScroll(obj){
  53. $(obj).find("ul").animate({
  54. marginTop : "-30px"
  55. },500,function(){
  56. $(this).css({marginTop : "0px"}).find("li:first").appendTo(this);
  57. })
  58. }
  59. $(function(){
  60. setInterval('autoScroll(".headle_right .content")',8000);
  61. })
  62. // 2018-10-11 轮播图
  63. var mySwiper1= new Swiper("#yw_swiper",{
  64. // loop : true,
  65. loopedSlides:4,
  66. autoplay:5500,
  67. autoplayDisableOnInteraction : false,
  68. // 如果需要分页器
  69. pagination: '.yw_swiper-pagination',
  70. slidesPerView :"auto",
  71. lazyLoading : true,
  72. lazyLoadingInPrevNext : true,
  73. lazyLoadingOnTransitionStart : true,
  74. });
  75. $(window).scroll(function (){
  76. var st = $(this).scrollTop();
  77. if(st >196){
  78. $('.suspension').fadeIn().addClass('xungua');
  79. $('.header').fadeOut();
  80. }else{
  81. $('.suspension').fadeOut();
  82. $('.header').fadeIn();
  83. }
  84. });
  85. $('.suspension').on('click',function(){
  86. $('body,html').animate({ scrollTop: 0 }, 1000);
  87. return false;
  88. })
  89. var trend = $('.y_quyou_list ul.list_m li').eq(0).find('a').attr('CityData');
  90. index_trend ();
  91. $(function(){
  92. var Citya = $('.y_quyou_list ul.list_m li').eq(0).find('a').text();
  93. $('.y_quyou em a').text(Citya);
  94. $('.y_quyou_list ul.list_m li').eq(0).attr('class','on');
  95. $('.y_quyou em').on('click',function(){
  96. $('.y_quyou_list_bg').fadeIn();
  97. $('.y_quyou_list').slideDown("slow");
  98. })
  99. $('.y_quyou_list_bg').on('click',function(){
  100. $(this).fadeOut();
  101. $('.y_quyou_list').fadeOut();
  102. })
  103. $('.y_quyou_list').on('click',function(){
  104. $(this).fadeOut();
  105. $('.y_quyou_list_bg').fadeOut();
  106. });
  107. $('.y_quyou_list ul.list_m li a').on('click',function(){
  108. $(this).parent().addClass('on').siblings().removeClass('on');
  109. var oAtexe=$(this).text();
  110. $('.y_quyou em a').text(oAtexe);
  111. // console.log(oAtexe);
  112. trend = $(this).attr('CityData');
  113. index_trend ();
  114. })
  115. });
  116. function index_trend (){
  117. // var html = '';
  118. // var _html ='';
  119. // $.ajax({
  120. // url: "/index/cityprice",
  121. // data:{id:trend},
  122. // type: "POST",
  123. // dataType: "json",
  124. // success: function(data) {//请求成功完成后要执行的方法
  125. // if(data.code == 200){
  126. // html+= '<p class="y_jg"><span>'+data.data.price+'</span><em>元/m²</em></p>';
  127. // html+= '<p class="y_text">'+ data.data.city_name + data.data.price_at +'房价均价</p>';
  128. // if(data.data.trend == 1){
  129. // _html+= '<img src="/image/fall1.png" alt=""><span class="red">上升'+data.data.contrast+'</span>';
  130. // } else if(data.data.trend == 2){
  131. // _html+= '<img src="/image/fall.png" alt=""><span class="lr">下跌-'+data.data.contrast+'</span>'; //上升下跌
  132. // }
  133. // }
  134. // $('.y_houspic_text').html(html);
  135. // $('.fall').html(_html);
  136. // }
  137. // });
  138. }
  139. // function m_hotlp_hyh (rand = null){
  140. // var cityId = $('#feng_city_id').html();
  141. // var type = $('#stype').html();
  142. // var html = '';
  143. // $.ajax({
  144. // url: "/index/hothouses",
  145. // data:{rand:rand,csrf_token_m:csrfToken,city:cityId,type:type},
  146. // type: "POST",
  147. // dataType: "json",
  148. // success: function(data) {
  149. // // console.log(data);
  150. // if(data.code == 200){
  151. // $.each(data.data, function (i, data) {
  152. // var randomX = 300;
  153. // var randomY = 800;
  154. // var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
  155. // html+= '<li>';
  156. // html+= '<a href="/house/'+data.id+'/">';
  157. // html+= '<div class="sell_img"><img src="'+data.thumb+'/same" alt=""><i class="sell_img_i" style="display:none">视频</i></div>';
  158. // html+= '<div class="sell_conter_right">';
  159. // html+= '<p class="title">'+data.name+'</p>';
  160. // html+= '<p class="jg_ing">'+data.city_name+'</p>';
  161. // if(data.sale_price != 0 && data.sale_price != null && data.sale_price != ''){
  162. // html+= '<p class="jg_ing jg_ingdd" style="margin-top:6px"><span><em>'+data.sale_price+'</em>'+data.price_unit+'</span></p>';
  163. // }else{
  164. // html+= '<p class="jg_ing jg_ingdd" style="margin-top:6px"><span><em>待定</em></span></p>';
  165. // }
  166. // html+= '<p class="jg_ing">有效期:'+time_mina+'</p>';
  167. // html+= '<p class="jg_ing" style="display:none">80㎡(一居)、86㎡(二居)</p>';
  168. // html+= '</div>';
  169. // html+= '<div class="m_gzlx">';
  170. // html+= '<p class="attention">已有 <span>'+randvalue+'</span> 人关注</p>';
  171. // html+= '<div class="m_gzlx_style">';
  172. // for(k in data.characteristic){
  173. // html+= '<i>'+data.characteristic[k]+'</i>';
  174. // }
  175. // html+= '</div>';
  176. // html+= '</div>';
  177. // html+= '</a>';
  178. // html+= '<div class="cal_price"><a href="tel:'+data.tel+'"><img src="/image/search/w_t.png"></a></div>';
  179. // html+= '</li>';
  180. // });
  181. // $(".sell_conter ul").html(html);
  182. // }
  183. // }
  184. // });
  185. // }
  186. //
  187. //
  188. // m_hotlp_hyh();
  189. // console.log(hyh);
  190. $('.m_hotlp_hyh').on('click',function(){
  191. // hyh = $(this).attr('DataId');
  192. m_hotlp_hyh(1);
  193. })
  194. $('.y_hotnews_bk li').on('click',function(){
  195. var dataid=$(this).attr('data-id');
  196. })
  197. // 切换区域
  198. $('.y_city a').on('click',function(){
  199. $('#serachBox2').hide();
  200. $('.footer_copy').hide();
  201. $('.m_qhcs_box').show();
  202. });
  203. $('.m_head_qhcs .m_Return').on('click',function(){
  204. $('#serachBox2').show();
  205. $('.m_qhcs_box').hide();
  206. $('.footer_copy').show();
  207. });
  208. // $('.m_City_list li a').on('click',function(){
  209. // var Citytext = $(this).html();
  210. // $('.y_city a span').html(Citytext);
  211. // $('#serachBox2').show();
  212. // $('.m_qhcs_box').hide();
  213. // });
  214. // $('.m_City_ul_li a').on('click',function(){
  215. // var Citytext2 = $(this).html();
  216. // $('.y_city a span').html(Citytext2);
  217. // $('#serachBox2').show();
  218. // $('.m_qhcs_box').hide();
  219. // });
  220. // 处理资讯详情页面的底部一个月的有效日期
  221. var myDate = new Date;
  222. var year = myDate.getFullYear(); //获取当前时间年份
  223. var yue = myDate.getMonth()+1;//获取当前时间月份
  224. if (yue<10) {
  225. yue= '0' + yue;
  226. }else if(yue == 13){
  227. yue = '01';
  228. };
  229. // 返回下个月有多少天数
  230. function mGetDate(yue){     
  231. var date = new Date();     
  232. var year = date.getFullYear();     
  233. var d = new Date(year,parseInt(yue), 0);
  234. return d.getDate();
  235. }
  236. var htmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue);
  237. $('.sell_conter_right .date').html('有效期 '+'&nbsp'+ htmltime);
  238. //限制字符个数
  239. $(".y_style1_text .y_title").each(function(){
  240. var maxwidth=35;
  241. if($(this).text().length>maxwidth){ $(this).text($(this).text().substring(0,maxwidth)); $(this).html($(this).html()+'…');
  242. }
  243. });
  244. $('.m_region span').eq(1).click();
  245. $('.m_City_box[data-id="1"]').show();
  246. $('.m_region span').on('click',function(){
  247. var dataid = $(this).attr('data-id');
  248. $('.m_City_box').hide()
  249. $('.m_City_box[data-id="'+dataid+'"]').show();
  250. $(this).attr('class','on').siblings().attr('class','');
  251. })