// 处理顶部导航显示、隐藏 var dir = $(document).scrollTop(); navign(dir); $(window).scroll(function (){ dir= $(this).scrollTop(); navign(dir); }); function navign(st){ if(st >70){ $('.m_topw').hide(); $('.m_top').show(); $('.m_title').show(); }else{ $('.m_topw').show(); $('.m_top').hide(); $('.m_title').hide(); } } /*--------------end----------------------*/ $(function(){ // 热推看房团 var m_Huxing_lunbo = new Swiper('.asw', { loop : true, spaceBetween: 10, centeredSlides: true, slidesPerView: 'auto', touchRatio: 0.5, slideToClickedSlide: true }); var m_Huxing_lunbo = new Swiper('.hothouses', { loop : true, spaceBetween: 10, centeredSlides: true, slidesPerView: 'auto', touchRatio: 0.5, slideToClickedSlide: true }); // 地区分类 new Swiper('.nation-re', { slidesPerView :'auto', slidesOffsetAfter:10, nextButton:'.bntr', }) /*-------------------- 获取地址栏地址并拆分 --------------------------------*/ function getParams(url) { var theRequest = new Object(); if (!url) url = location.href; if (url.indexOf("?") !== -1) { var str = url.substr(url.indexOf("?") + 1) + "&"; var strs = str.split("&"); for (var i = 0; i < strs.length - 1; i++) { var key = strs[i].substring(0, strs[i].indexOf("=")); var val = strs[i].substring(strs[i].indexOf("=") + 1); theRequest[key] = val; } } return theRequest; } var objUrl = {}; //获取get参数 var url = window.location.href; var params = getParams(url); if(!$.isEmptyObject(params)){ $.each(params,function(key,val){ objUrl[key] = val; }) } // if(objUrl['cid'] == undefined || objUrl['cid'] == 'undefined'){ // $('.nation-conter-nav ul li').css('pointer-events','none');//没有选择city禁止点击 // } // // if(objUrl['cid']== 0){ // $('.nation-conter-nav ul li').css('pointer-events','none');//没有选择city禁止点击 // } // 类目导航 $('.nation-conter-nav ul li').on('click',function(){ var that = $(this); var oid = that.attr('data-oid'); that.addClass('on').siblings('li').removeClass('on'); objUrl['type'] = oid; skipUrl(objUrl); }) // 国家导航 $('.nation-re ul li').on('click',function(){ var that = $(this); var cid = that.attr('data-city'); that.addClass('on').siblings('li').removeClass('on'); objUrl['cid'] = cid; skipUrl(objUrl); }) function skipUrl(data){ var urlParams =""; if(data.cid == 0){ window.location.href = '/news/knowledge'; return false; } $.each(data,function(key,val){ if(key != 'page'){ urlParams += key+'='+val+'&'; } }) var cityUrl = ''; urlParams = urlParams.substring(0,urlParams.length - 1); if(urlParams == '' && cityUrl != ''){ cityUrl = cityUrl.substring(0,cityUrl.length - 1); } window.location.href = '/news/knowledge?'+urlParams; } if ($('.js_daqsClick ul li').length > 1) { $('.js_daqsClick ul li').addClass('hide') $('.js_daqsClick ul').on('click','li',function(){ var _this=$(this) var _Qhtml= _this.find('.qs span').text(); var _Ahtml= _this.find('.fa span').text(); var _City= $('.js_nation_re ul li.on').text(); var _Navhtml= $('.js_nationNav ul li.on').text(); $('.js_faqsBox_title span').html(_City); $('.js_faqsBox_title em').html(_Navhtml); $('.js_faqsBox_html .y_boxq span').html(_Qhtml); $('.js_faqsBox_html .y_boxa span').html(_Ahtml); $('.js_faqsBox').show(30); $('.y_faqsBox_bg').show(); }) $('.y_faqsBox_bg,.y_faqsBox_gb').on('click',function(){ $('.y_faqsBox_bg,.js_faqsBox').hide(); }) } $('.time_box').html('(有效期:'+whtmltimes+')'); })