123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- $(function(){
- // 轮播图
- var mySwiper1 = new Swiper('#swiper1',{
- autoplay:true, //自动切换
- loop : true, //循环
- pagination: '.swiper-pagination', // 如果需要分页器
- })
- // 导航
- var mySwiper1 = new Swiper('#xgnav',{
- autoplay:false, //自动切换
- // loop : true, //循环
- pagination: '.swiper-pagination', // 如果需要分页器
- slidesPerView : 4,
- slidesPerGroup : 4,
- })
- // 特价活动
- new Swiper('.sale',{
- slidesPerView :'auto',
- slidesPerView : 3,
- slidesPerGroup :3,
- spaceBetween : 5,
- pagination: '.saleb', // 如果需要分页器
- });
- // 资讯分类
- var swiper2 = new Swiper('#swiper2',{
- slidesPerView :'auto',
- slidesPerGroup : 2.2,
- });
- // 房价一览
- var mySwiper1 = new Swiper('#swiper3',{
- autoplay:true, //自动切换
- loop : true, //循环
- pagination: '.swiper-pagination3', // 如果需要分页器
- })
- // 精选房源
- var swiper4 = new Swiper('#swiper4',{
- autoplay:true, //自动切换
- // loop : true, //循环
- slidesPerView :'auto',
- slidesPerGroup : 1,
- });
- // 精选房源
- var swiper5 = new Swiper('#swiper5',{
- // autoplay:true, //自动切换
- // loop : true, //循环
- slidesPerView :'auto',
- slidesPerGroup : 1,
- });
- // 精选房源
- var swiper6 = new Swiper('#swiper6',{
- // autoplay:true, //自动切换
- // loop : true, //循环
- slidesPerView :'auto',
- slidesPerGroup : 1,
- });
- // 精选房源
- var swiper7 = new Swiper('#swiper7',{
- // autoplay:true, //自动切换
- // loop : true, //循环
- slidesPerView :'auto',
- slidesPerGroup : 1,
- });
- $('.m_lp_list ul li').each(function(){
-
- var _height = $(this).find('.m_lp_list_img p span').innerHeight() / 2;
- $(this).find('.m_lp_list_img p span').css('margin-top',- _height +'px');
- // console.log(_height);
- })
-
-
-
- // 精选房源
- // var presentData = {"dataID":"0","type":""}
- // $('.m_title_nav a').on('click',function(){
- // var that = $(this);
- // var oid = that.attr("data-id");
- // var type = that.attr("data-type");
- // that.addClass('on').siblings().removeClass('on');
- // presentData.dataID = oid;
- // presentData.type = type;
- // fn_ajax(presentData)
- // })
- function fn_ajax(obj){
- // console.log(obj)
- var url = '';
- if(obj.type == 'housing'){
- url = './js/index.json';
- }else if(obj.type == 'news'){
- url = './js/index_news.json';
- }
- $.ajax({
- type: "post",
- url: url,
- data: obj,
- dataType: "json",
- success: function(data){
- console.log(data.data);
- if(data.code == 200){
- console.log(data.data);
- switch(obj.type)
- {
- case 'housing':
- sift(data.data)
- break;
- case 'news':
- fn_news(data.data)
- break;
- }
- }
- }
- });
- }
- //精选楼盘
- function sift(obj){
- var li = '';
- $.each(obj,function(k,v){
- li += '<li class="swiper-slide" data-swiper-autoplay="3000">';
- li += '<a href="javascript:void(0);">';
- li += '<div class="lp_list_img"><img src="'+v.imgUrl+'" alt=""></div>';
- li += '<p class="lp_name">'+v.lp_name+'</p>';
- li += '<p class="lp_l">'+v.area+'</p>';
- li += '<p class="lp_b"><span>¥</span>'+v.price+v.uint+'</p>';
- li += '</a>';
- li += '</li>';
- })
- $('#swiper4 ul.swiper-wrapper').html('');
- $('#swiper4 ul.swiper-wrapper').append(li);
- // 精选房源
- var swiper4 = new Swiper('#swiper4',{
- // autoplay:true, //自动切换
- slidesPerView : 1.5,
- slidesPerGroup : 1.5,
- });
- }
- // 新闻资讯
- function fn_news(obj){
- console.log(obj)
- var _li ='';
- $.each(obj,function(k,v){
- if(v.type == 1){
- _li +='<li>';
- _li +='<a href="javascript:void(0);">';
- _li +='<div class="n_list_tit">泰国曼谷白领中心中心61万平综合体树立</div>';
- _li +='<div class="n_list_img"><img src="./image/index/n1.png" alt=""></div>';
- _li +='<div class="n_list_font">';
- _li +='<em>最新</em>';
- _li +='<span>2018-09-11</span>';
- _li +='<em>详情</em>';
- _li +='</div>';
- _li +='</a>';
- _li +='</li>';
- }else if(v.type == 2){
- _li +='<li>';
- _li +='<a href="javascript:void(0);">';
- _li +='<div class="n_li_img"><img src="./image/index/n2.png" alt=""></div>';
- _li +='<div class="n_li_tit">';
- _li +='<p>房子面积越大越好吗?看看 国外多大的房子最受欢...</p>';
- _li +='<p>2018-09-11</p>';
- _li +='</div>';
- _li +='</a>';
- _li +='</li>';
- }else if(v.type == 3){
- _li += '<li>';
- _li += '<a href="javascript:void(0);">';
- _li += '<div class="n_li_m3">芭提雅房价如何?贵不贵?</div>';
- _li += '<div class="n_li_tit3">人们创造的丽思卡尔顿 West Side Place 奢华公寓,誉为“全世界屋顶”的奢华酒店品牌...</div>';
- _li += '<div class="n_li_font3">';
- _li += '<em>文章</em>';
- _li += '<span>2018-09-11</span>';
- _li += '</div>';
- _li += '</a>';
- _li += '</li>';
- }
- })
-
- $('.n_li ul').html('');
- $('.n_li ul').append(_li);
- }
- $('.m_jpzpt_box').attr('id','m_jpzpt_box');
- })
- // 房产资讯
- function autoScroll(obj){
- $(obj).find("ul").animate({
- marginTop : "-50px"
- },500,function(){
- $(this).css({marginTop : "0px"}).find("li:eq(0),li:eq(1)").appendTo(this);
- // $(this).css({marginTop : "0px"}).find("li:prev").appendTo(this);
- })
- }
- $(function(){
- setInterval('autoScroll(".headle_right .content")',5000);
- })
- /*
- * 获取 DOC 超出可视区域的高度
- */
- $(window).scroll(function (){
- var ster = $(this).scrollTop();
- navign1(ster);
- });
- var dir1 = $(document).scrollTop();
- navign1(dir1);
- function navign1(st){
- if(st >180){
- $('.m_top').fadeOut(100);
- $('.m_top1').fadeIn(100);
- }else if(st>80 && st <= 180){
- $('.m_top').css('background','rgba(0,0,0,0.2)');
- }else{
- $('.m_top').css('background','rgba(0,0,0,0)');
- $('.m_top').fadeIn(100);
- $('.m_top1').fadeOut(100);
- }
- }
|