index.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. $(function(){
  2. // 限时特惠滚动js
  3. var obj=$('.ztHead_intr');
  4. var dw=obj.find(".lpjs").width();
  5. var cw=obj.find(".lpjs span").width();
  6. var cx=0;
  7. //宽度超出当前content宽度才滚动
  8. if(cw>dw){
  9. var scrollval=null;//滚动事件变量
  10. obj.find(".lpjs span").append(obj.find(".lpjs i").eq(0).html());
  11. function move(){
  12. obj.find(".lpjs span").css({
  13. "left":"-"+cx+"px"
  14. })
  15. if(cx>(cw-dw)+dw)
  16. cx=0;
  17. cx++;
  18. }
  19. scrollval = setInterval(move,35);
  20. obj.mouseover(function(){
  21. clearInterval(scrollval);
  22. });
  23. obj.mouseout(function(){
  24. scrollval = setInterval(move,35);
  25. })
  26. }
  27. // 调取数据ajax
  28. var cityId=""
  29. var cityName=""
  30. cityId=$('.susp_main ul li').eq(0).attr('data-id');
  31. $('.susp_main ul li').eq(0).addClass('on');
  32. cityName=$('.susp_main ul li').eq(0).find('a').text();
  33. $('.main_title span').html(cityName+'热卖房产TOP榜');
  34. chunjiezt();
  35. $('.value_pulic[data-id="'+cityId+'"]').show();
  36. $('.susp_main ul li').on('click',function(){
  37. $(this).addClass('on').siblings().removeClass('on');
  38. cityId=$(this).attr('data-id');
  39. cityName=$(this).find('a').text();
  40. $('.main_title span').html(cityName+'热卖房产TOP榜')
  41. $('.cityValue_m p.title_text').html('带你读懂'+cityName+'置业优势');
  42. $('body input[name="intention_city"]').val(cityName);
  43. chunjiezt();
  44. $('.value_pulic').hide();
  45. $('.value_pulic[data-id="'+cityId+'"]').show();
  46. })
  47. function chunjiezt(){
  48. $('.lplist_mainbox').html('')
  49. // $('.value_pulic').html('')
  50. var _html="";
  51. var _value='';
  52. $.ajax({
  53. type:'POST',
  54. url:'/zt/chunjieztform',
  55. data:{id:cityId},
  56. async:false,
  57. dataType:'json',
  58. success:function(data){
  59. if(data.code == 200){
  60. var _data=data.data;
  61. _html+='<div class="lplist_main">';
  62. _html+='<ul class="swiper-wrapper">';
  63. $.each(_data,function (key,val) {
  64. _html+='<li class="swiper-slide" data-hid="'+val.id+'" data-source="'+val.id+'">';
  65. _html+='<div class="topcenter">';
  66. _html+='<a href="/house/'+val.id+'">';
  67. _html+='<div class="lpimg">';
  68. _html+='<img src="'+val.thumb+'" alt="">';
  69. _html+='</div>';
  70. _html+='<div class="lptext">';
  71. _html+='<div class="lptitle c">';
  72. _html+='<p class="left">';
  73. _html+='<i><img src="/zt/xinnain2020/image/ico_7.png" alt=""></i>';
  74. _html+='<span>'+val.name+'</span>';
  75. _html+='</p>';
  76. _html+='<p class="right">';
  77. _html+='<i><img src="/zt/xinnain2020/image/ico_13.png" alt=""></i>';
  78. _html+='<span>'+val.cityName.city_name+'</span>';
  79. _html+='</p>';
  80. _html+='</div>';
  81. _html+='<div class="lppric">';
  82. if(val.housedetail.preferential_price =='' || val.housedetail.preferential_price == null){
  83. _html+='<span>待定</span>';
  84. }else{
  85. _html+='<i><img src="/zt/xinnain2020/image/ico_2.png" alt=""></i>';
  86. _html+= val.housedetail.preferential_price;
  87. }
  88. // _html+='<span>1300<em>万</em></span>';
  89. _html+='<b>'+val.expiration_date+'</b>';
  90. _html+='</div>';
  91. _html+='<div class="lpzkou">';
  92. _html+='<p class="lpzkou_m c">';
  93. _html+='<em>新春钜惠 :</em>';
  94. _html+='<span>';
  95. if(val.housedetail.preferential_zt == '' || val.housedetail.preferential_zt == null){
  96. _html+='<i>暂无</i>';
  97. }else{
  98. _html+='<i>'+val.housedetail.preferential_zt+'</i>';
  99. }
  100. _html+='</span>';
  101. _html+='</p>';
  102. _html+='</div>';
  103. _html+='<div class="lptuij">';
  104. _html+='<p class="t">';
  105. _html+='<i><img src="/zt/xinnain2020/image/ico_3.png" alt=""></i>';
  106. _html+='<span>推荐理由</span>';
  107. _html+='</p>';
  108. if(val.housedetail.push_reason == '' || val.housedetail.push_reason == null){
  109. _html+='<p class="b">暂无</p>';
  110. }else{
  111. _html+='<p class="b">'+val.housedetail.push_reason+'</p>';
  112. }
  113. _html+='</div>';
  114. _html+='<div class="lptuij">';
  115. _html+='<p class="t">';
  116. _html+='<i><img src="/zt/xinnain2020/image/ico_6.png" alt=""></i>';
  117. _html+='<span>楼盘地址</span>';
  118. _html+='</p>';
  119. _html+='<p class="b">'+val.housedetail.address+'</p>';
  120. _html+='</div>';
  121. _html+='</div>';
  122. _html+='</a>';
  123. _html+='</div>';
  124. _html+='</li>';
  125. })
  126. _html+='</ul>';
  127. _html+='</div>';
  128. // $.each(_data,function (key,val) {
  129. // var _key=key+1
  130. // _value+='<div class="pul_mo c">';
  131. // if ( _key%2 ==0) {
  132. // _value+='<div class="pule_ico pule_right fr">';
  133. // }else{
  134. // _value+='<div class="pule_ico fl">';
  135. // }
  136. // _value+='<p><img src="/zt/xinnain2020/image/ico_18.png" alt=""></p>';
  137. // _value+='<i></i>';
  138. // _value+='</div>';
  139. // if ( _key%2 ==0) {
  140. // _value+='<div class="pule_text fl">';
  141. // }else{
  142. // _value+='<div class="pule_text fr">';
  143. // }
  144. // _value+='<p class="Ii">'+_key+'. 宜居环境</p>';
  145. // _value+='<p class="It">海南四季温暖且森林覆盖率高,负氧离子充足。海南以优美的热带滨海风光为主要特色,是国内居住旅游的优选之地。</p>';
  146. // _value+='</div>';
  147. // _value+='</div>';
  148. // if ( _key%2 ==0) {
  149. // _value+='<div class="Dividing"><img src="/zt/xinnain2020/image/ico_24.png" alt=""></div>';
  150. // }else{
  151. // _value+='<div class="Dividing"><img src="/zt/xinnain2020/image/ico_23.png" alt=""></div>';
  152. // }
  153. // })
  154. $('.lplist_mainbox').html(_html);
  155. // $('.value_pulic').html(_value);
  156. // 轮播图
  157. var mySwiper1 = new Swiper('.lplist_main',{
  158. autoplay:false, //自动切换
  159. loop : true, //循环
  160. pagination: '.swiper-pagination', // 如果需要分页器
  161. onSlideChangeEnd: function(swiper){
  162. var lphid=$('.lplist_main .swiper-slide-duplicate-active').attr('data-hid');
  163. $('.lpfoot_but a.in_but').attr('data-hid',lphid);
  164. },
  165. })
  166. }
  167. }
  168. })
  169. }
  170. // 豪礼报名js
  171. $("body").on('click','.luxury_buttom',function(){
  172. var bmhid=$(this).attr('data-hid');
  173. var bmsource=$(this).attr('data-source');
  174. $('.luxuryMain form input[name="hid"]').val(bmhid)
  175. $('.luxuryMain form input[name="source"]').val(bmsource)
  176. $('.luxuryBox').show(30);
  177. $('.luxuryBg').show();
  178. })
  179. $('.luxuryBg,.ico_bg').on('click',function(){
  180. $('.luxuryBox').hide();
  181. $('.luxuryBg').hide();
  182. $('body input[type="text"]').val('');
  183. })
  184. // 豪礼报名js
  185. $("body").on('click','.purchase_buttom',function(){
  186. $('.purchaseBox').show(30);
  187. $('.purchaseBg').show();
  188. })
  189. $('.purchaseBg,.pu_gb').on('click',function(){
  190. $('.purchaseBox').hide();
  191. $('.purchaseBg').hide();
  192. $('body input[type="text"]').val('');
  193. })
  194. // 右边悬挂
  195. $(window).scroll(function (){
  196. var st = $(this).scrollTop();
  197. // console.log(st);
  198. if(st >170){
  199. $('.suspBox').show();
  200. }else{
  201. $('.suspBox').hide();
  202. }
  203. });
  204. $('.Pgup').on('click',function(){
  205. $('html,body').animate({scrollTop: '0px'}, 500);
  206. })
  207. // 报名提交事件
  208. PublicAction.AjaxSend(
  209. {
  210. CORID:'buttom_tj', /*操作ID*/
  211. }
  212. );
  213. $('.submit_area .buttom_tj').on('click',function(){
  214. setTimeout(function(){
  215. var _html = $('.alert-container .alert-content').html();
  216. if(_html == '提交成功'){
  217. $('.purchaseBox').hide();
  218. $('.purchaseBg').hide();
  219. $('.luxuryBox').hide();
  220. $('.luxuryBg').hide();
  221. $('body input[type="text"]').val('');
  222. }
  223. },300)
  224. })
  225. })