.subl2c2.tmp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. $(function(){
  2. // 热推看房团
  3. new Swiper('.hot-box',{
  4. slidesPerView :'auto',
  5. spaceBetween : 20,
  6. prevButton:'.hotprev',
  7. nextButton:'.hotnext',
  8. })
  9. var oid = false;
  10. var aClass = $('.widget-box');
  11. // 关闭按钮
  12. $('.widget-cls').on('click',function(){
  13. aClass.removeClass('adi');
  14. oid = aClass.hasClass('adi');
  15. aClass.animate({width:'8px',height:'8px',right:'100px',bottom:'325px'},function(){
  16. var _this = $(this);
  17. _this.animate({bottom:'280px'},function(){
  18. _this.hide();
  19. })
  20. })
  21. })
  22. // 点击按钮弹出报名窗口
  23. $('.alive').on('click',function(){
  24. if(!oid){
  25. aClass.show();
  26. aClass.animate({width:'8px',height:'8px',right:'100px',bottom:'325px'},function(){
  27. var _this = $(this);
  28. _this.animate({width:'240px',height:'312px',right:'20px',bottom:'350px'})
  29. })
  30. }
  31. aClass.addClass('adi');
  32. oid = aClass.hasClass('adi')
  33. })
  34. /*-------------------- 获取地址栏地址并拆分 --------------------------------*/
  35. function getParams(url) {
  36. var theRequest = new Object();
  37. if (!url)
  38. url = location.href;
  39. if (url.indexOf("?") !== -1)
  40. {
  41. var str = url.substr(url.indexOf("?") + 1) + "&";
  42. var strs = str.split("&");
  43. for (var i = 0; i < strs.length - 1; i++)
  44. {
  45. var key = strs[i].substring(0, strs[i].indexOf("="));
  46. var val = strs[i].substring(strs[i].indexOf("=") + 1);
  47. theRequest[key] = val;
  48. }
  49. }
  50. return theRequest;
  51. }
  52. var objUrl = {}; //获取get参数
  53. var url = window.location.href;
  54. var params = getParams(url);
  55. if(!$.isEmptyObject(params)){
  56. $.each(params,function(key,val){
  57. objUrl[key] = val;
  58. })
  59. }
  60. // 类目导航
  61. $('.top-nav-li ul li').on('click',function(){
  62. var that = $(this);
  63. var oid = that.attr('data-oid');
  64. that.addClass('on').siblings('li').removeClass('on');
  65. objUrl['type'] = oid;
  66. skipUrl(objUrl);
  67. })
  68. // 国家导航
  69. $('.genera-center-nav ul li').on('click',function(){
  70. var that = $(this);
  71. var cid = that.attr('data-city');
  72. that.addClass('on').siblings('li').removeClass('on');
  73. objUrl['cid'] = cid;
  74. skipUrl(objUrl);
  75. })
  76. function skipUrl(data){
  77. // console.log(data)
  78. var urlParams ="";
  79. $.each(data,function(key,val){
  80. urlParams += key+'='+val+'&';
  81. })
  82. var cityUrl = '';
  83. urlParams = urlParams.substring(0,urlParams.length - 1);
  84. if(urlParams == '' && cityUrl != ''){
  85. cityUrl = cityUrl.substring(0,cityUrl.length - 1);
  86. }
  87. // console.log(cityUrl)
  88. // console.log(urlParams)
  89. window.location.href = '/news/knowledge?'+urlParams;
  90. }
  91. /*
  92. * 调用的方法
  93. * */
  94. PublicAction.AjaxSend(
  95. {
  96. CORID:'apply_submit', /*操作ID*/
  97. }
  98. );
  99. // 问答字数限制
  100. $('.faqs-box ul li').each(function(){
  101. var _that=$(this);
  102. var _txtm=_that.find('.fa span em').text();
  103. var _txtlength= _that.find('.fa span em').text().length;
  104. if (_txtlength > 115) {
  105. _that.find('.fa span em').text(_txtm.substring(0,num)+"...");
  106. }
  107. console.log(_txt);
  108. })
  109. jQuery.fn.limit=function(){
  110. var self = $("[limit]");
  111. self.each(function(){
  112. var objString = $(this).text();
  113. var objLength = $(this).text().length;
  114. var num = $(this).attr("limit");
  115. if(objLength > num){
  116. $(this).attr("title",objString);
  117. objString = $(this).text(objString.substring(0,num)+"...");
  118. }
  119. $(this).attr("title"," ")
  120. })
  121. }
  122. // $(function(){
  123. // $(".list li a").attr("limit",18)
  124. // $("#last_show p").attr("limit",35)
  125. // $(".newsList li a").attr("limit",24)
  126. // $("[limit]").limit();
  127. // })
  128. })