var before = $(window).scrollTop(); var direction; $(window).scroll(function (){ var after = $(window).scrollTop(); var st = $(this).scrollTop(); if(st >50){ // $('.y_header').hide(); $('.wm-top').show(); $('.wm-top').addClass('wtop'); }else{ $('.wm-top').hide(); $('.wm-top').removeClass('wtop'); // $('.y_header').show(); } }); 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 searchParams = ''; //最后拼接的参数 var urlParams = ''; // 页数 var page = 0; // 每页展示5个 var size = 10; var oid = 60; var params = getParams(url); //获取get请求的参数 if(!$.isEmptyObject(params)){ oid=params.city; } $('.y_qylist_hoe').on('click','.y_qylist_con',function () { var _this = $(this); oid = _this.attr('data-id'); window.location.href = '/timelimitsgroup/index?city='+oid; }) $(function(){ var onoff=true; $('.y_homelist_list').dropload({ scrollArea : window, loadDownFn : function(me,da){ page++; // 拼接HTML var result = ''; $.ajax({ type: 'GET', url: '/timelimitsgroup/gethouselist', data:{id:oid,page:page,limit:size}, dataType: 'json', async:false, success: function(data){ var data = data.data; if(data != null){ $.each(data,function (key,val) { var randomX = 300; var randomY = 800; var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY); var dataID = (key+1)+(page-1)*size; if(dataID % 10 == 0){ if(onoff){ result += apply(); // onoff=false; } } result += '
  • ' +'
    ' +'

    ' +'' +'' +'
    ' +'
    ' +'' +'
    ' +''+val.citytel+'' +'
    ' +'
    ' +'
    ' +'

    已有 '+randvalue+' 关注

    ' +'

    ' if(val.characteristic){ $.each(val.characteristic,function(k,v){ result +=''+v+''; }) } result+='

    ' +'
    ' +'
  • ' }) // 如果没有数据 }else{ // 锁定 me.lock(); // 无数据 me.noData(); } // 为了测试,延迟1秒加载 setTimeout(function(){ // 插入数据到页面,放到最后面 $('.y_homelist_list ul').append(result); // 每次数据插入,必须重置 me.resetload(); },100); }, error: function(xhr, type){ // alert('Ajax error!'); // 即使加载出错,也得重置 me.resetload(); } }); } }); }); $.each($('.m_nav_qy').find('a'),function(){ var each_name = $(this).attr('name'); var each_val = $(this).attr('value'); if(each_val == objUrl[each_name]){ $(this).attr('id','nav'); } }) // $(".y_qylist_cnet_ind").on('click','a.link-item',function(){ var _this = $(this); _this.addClass('on'); _this.siblings().removeClass('on'); $('.three_area').show(); // _this.show(); $.post('/house/soncity',{pid:_this.attr('value')},function(data){ $(".three_area").html(''); if(data.code == 200){ var str = ''; str += ''+_this.find('span').html()+''; $.each(data.data,function (k,v) { str += ''+v.city_name+''; }) } $(".three_area").append(str); }) $(".three_area").animate({left:"35%"}); }) $(".y_qylist_cnet_ind").on('click','a.actived-item',function(){ $(".three_area").animate({left:"100%"}); }) //报名 $('.m_Find_submit').on('click',function() { var mobile=$('.m_Find_room_form input[name="mobile"]').val(); var name=$('.m_Find_room_form input[name="name"]').val(); var pit=$('.m_Find_room_form input[name="pit"]').val(); var city=$('.m_Find_room_form input[name="city"]').val(); var type=$('.m_Find_room_form input[name="type"]').val(); var yxhx=$('.m_Find_room_form input[name="informs"]').val(); var yusuan=$('.m_Find_room_form input[name="content"]').val(); var data = ''; yee.showings(mobile,name,pit,city,type,yxhx,yusuan,data); }) $('.y_lpsub').on('click',function() { var data = ''; yee.showings($('.y_lpind_addipunt input[name="mobile"]').val(),$('.y_lpind_addipunt input[name="name"]').val(),$('.y_lpind_addipunt input[name="pid"]').val(),$('.y_lpind_addipunt input[name="city"]').val(),$('.y_lpind_addipunt input[name="type"]').val(),data); }) // function waptab(name1,name2,name3){ // $(name1).on('click',function(){ // $(name2).hide(); // var Idoption = $(this).attr(name3); // var that = $(this); // if($(this).hasClass('on')){ //判断css on 是否存在 // that.parents('.y_qylist').find(name2+'['+name3+''+'='+ Idoption +']').hide(); // $(this).removeClass('on'); // }else{ // $(this).addClass('on').siblings().removeClass('on'); // that.parents('.y_qylist').find(name2+'['+name3+''+'='+ Idoption +']').show(); // } // }) // } // waptab('.y_qylist_hoe .y_qylist_con','.y_qylist_cnet_ind','data-id'); // 有效期 时间加两个自然月 function getNextMonth(date) { var arr = date.split('/'); var year = arr[0]; //获取当前日期的年份 var month = arr[1]; //获取当前日期的月份 var day = arr[2]; //获取当前日期的日 var days = new Date(year, month, 0); days = days.getDate(); //获取当前日期中的月的天数 var year2 = year; var month2 = parseInt(month) + 2; if (month2 > 13) { year2 = parseInt(year2) + 1; if (parseInt(month)==11) { month2 = 1; }else if (parseInt(month)==12) { month2 = 2; }; } var day2 = day; var days2 = new Date(year2, month2, 0); days2 = days2.getDate(); if (day2 > days2) { day2 = days2; } if (month2 < 10) { month2 = '0' + month2; } var t2 = year2 + '/' + month2 + '/' + day2; return t2; } var myDate = new Date; var year = myDate.getFullYear(); //获取当前时间年份 var yue = myDate.getMonth()+1;//获取当前时间月份 if (yue<10) { yue= '0' + yue; }; // 有效期时间 获取当前时间 var time = year+'/'+yue+'/01'; // 处理选中价格 function price_deal(subject){ switch(subject){ case '8000-10000元': subject = '8千-1万'; break; case '6000-8000元': subject = '6-8千'; break; case '4000-6000元': subject = '4-6千'; break; case '4000元以下': subject = '4千以下'; break; default: subject = 1; break; } return subject; } // 处理跳转过来选中价格 var textspan=$('.y_qylist_con p.feng_price span').text(); $('.y_qylist_con p.feng_price span').text(price_deal2(textspan)) function price_deal2(subject2){ switch(subject2){ case '8000-10000元': subject2 = '8千-1万'; break; case '6000-8000元': subject2 = '6-8千'; break; case '4000-6000元': subject2 = '4-6千'; break; case '4000元以下': subject2 = '4千以下'; break; } return subject2; } // 添加报名窗口 function apply(){ var _div =""; _div +='
    '; // _div +='
    设置楼盘动态提醒,加推开盘早知道
    ' _div +='
    '; _div +='
    '; _div +=' '; _div +=' '; _div +=' '; _div +=''; _div +='帮我找房'; _div +='
    '; _div +='
    '; return _div; }