details.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. $(function(){
  2. var page = 1,limit=1;
  3. var oid =$('.chapter p em').attr('data-id');
  4. // 下一篇
  5. $('.chapter p em').on('click',function(){
  6. page++;
  7. fnAjax();
  8. })
  9. // 下一篇请求方法
  10. function fnAjax(){
  11. $.ajax({
  12. type: "post",
  13. url: "/news/next",
  14. data:{id:oid,page:page,limit:limit},
  15. dataType: "json",
  16. success: function(data){
  17. if(data.code == 200){
  18. // console.log(data.data)
  19. $('.chapter p.l span').html('<a href="/news/details/'+data.data.left_id+'">'+data.data.left+'</a>')
  20. $('.chapter p.r span').html('<a href="/news/details/'+data.data.id+'">'+data.data.subject+'</a>')
  21. }
  22. }
  23. });
  24. }
  25. fnAjax();
  26. // 换一换
  27. $('.lp_push em').on('click',function(){
  28. $.ajax({
  29. type: "post",
  30. url: "/news/morehouse",
  31. dataType: "json",
  32. success: function(data){
  33. if(data.code == 200){
  34. // console.log(data.data)
  35. var data=data.data;
  36. var _li ='';
  37. $.each(data,function(k,v){
  38. _li +='<li>';
  39. _li +='<a href="/house/jinbian-'+v.id+'/">'
  40. _li +='<div class="push_img"><img src="'+v.thumb+'" alt=""></div>';
  41. _li +='<div class="push_font">';
  42. _li +='<p>'+v.name+'</p>';
  43. _li +='<p>'+v.main_city+' - '+v.city_name+'</p>';
  44. _li +='<p>'+v.price+'<i>'+v.price_nuit+'</i></p>';
  45. _li +='<p><em>'+v.main_units+'</em></p>';
  46. _li +='</div>';
  47. _li +='</a>';
  48. _li +='</li>';
  49. })
  50. $('.push_box ul').html("");
  51. $('.push_box ul').append(_li);
  52. }
  53. }
  54. });
  55. })
  56. })
  57. /*调用的方法*/
  58. PublicAction.AjaxSend(
  59. {
  60. CORID:'apply_su', /*操作ID*/
  61. }
  62. );
  63. /*调用的方法*/
  64. PublicAction.AjaxSend(
  65. {
  66. CORID:'apply_s', /*操作ID*/
  67. }
  68. );
  69. $(function(){
  70. $('.details_cont').find('img').each(function(){
  71. var $that = $(this);
  72. $that.removeAttr('width');
  73. $that.removeAttr('height');
  74. if($that.attr('alt') != 'alt'){
  75. $that.css({'width':'100%','height':'auto'});
  76. }
  77. })
  78. var swiper = new Swiper('.newsSlide_box', {
  79. loop : true,
  80. autoplay : 5000,
  81. pagination: '.newsSlide .swiper-pagination',
  82. paginationClickable: true,
  83. paginationBulletRender: function (swiper, index, className) {
  84. return '<span class="' + className + '">' + (index + 1) + '</span>';
  85. }
  86. });
  87. var swiper = new Swiper('.hotwenda_main', {
  88. loop : true,
  89. autoplay : 5000,
  90. slidesPerView:1,
  91. autoHeight: true, //高度随内容变化
  92. });
  93. })