12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- $(function(){
- $('.ban_bnt').on('click','a',function(){
- var _this = $(this);
- var oid = _this.attr('data-id');
- // console.log(oid)
- _this.addClass('on').siblings().removeClass('on');
- FnAjax(oid); //调用AJAX数据
- })
- $('.ban_bnt a').eq(0).click();
- // ajax
- function FnAjax(oid){
- $.ajax({
- url:"/zt/windform",
- type:"post",
- data:{id:oid},
- dataType:"json",
- success:function(data){
- if(data.code == 200){
- FnTraverse(data.data);
- }
- },
- error:function(request){
- console.log('加载失败!');
- }
- })
- }
- // 数据遍历
- function FnTraverse(data){
- var _html = '';
- $.each(data,function(k,v){
- _html += '<li class="swiper-slide" data-swiper-autoplay="3500">';
- _html += '<a href="/house/'+v.id+'/">';
- _html += '<div class="ban_img"><img src="'+v.thumb+'" alt=""></div>';
- _html += '<div class="ban_font">';
- _html += '<p class="ban_title"><em>'+v.name+'</em><span>¥'+v.price+'</span></p>';
- _html += '<p class="house_type">户型:'+v.main_units+'</p>';
- _html += '<p class="explain"><img src="/zt/wind1/image/icon_map.png" alt="">'+v.address+'</p>';
- _html += '</div>';
- _html += '</a>';
- _html += '</li>';
- })
- $('.ban_conter ul').html("");
- $('.ban_conter ul').append(_html);
- // 精选房源
- var swiper4 = new Swiper('#swiper4',{
- autoplay:true, //自动切换
- // loop : true, //循环
- slidesPerView :'auto',
- slidesPerGroup : 1,
- nextButton: '.next',
- prevButton: '.prev',
- pagination : '.ld',
- paginationType : 'fraction',
- });
- }
-
- })
|