//地图盒子的高度 var windheight=$(window).height(); var divheight=$('.y_maphead').height(); var navheight=$('.y_puicdh_c').height(); var windwidth=$(window).width(); var divwidth=$('.y_mapcenter_left').width(); $('.y_mapcenter').css({'height':(windheight-divheight-navheight)+'px'}); $('.y_mapcenter_main').css({'width':(windwidth-divwidth-20)+'px'}); // $('.y_mapcond_main .y_mapcond_right span a').hide(); // 地图找房 区域效果 $(function(){ $('.y_maptop_scr').keyup(function(event) { if(event.keyCode==13){ $('.y_maptop_sub').click(); console.log('提交'); return false; }else{ lplist(); } }); navMouseleave('#y_maptop_sel1','#y_maptop_sel1 .y_qysf'); navMouseleave('#y_maptop_sel2','#y_maptop_sel2 .y_qysf'); navMouseleave('#y_maptop_sel3','#y_maptop_sel3 .y_qysf'); navMouseleave('#y_maptop_sel4','#y_maptop_sel4 .y_qysf'); $('#y_maptop_sel1 .y_left a').on('mouseover',function(){ var cyit=$(this).attr('city'); var sjtitle=$(this).text(); $(this).css({'color':'#f00'}).siblings().css({'color':'#666'}); $('#y_maptop_sel1 p.y_right').attr('sj-city',''+sjtitle+'') $.post('/js/navs.json',{cyit:cyit,csrf_token_f:111},function(data){ var echodataUl = $('#y_maptop_sel1 p.y_right'); echodataUl.html(''); var data = data.data; var html = ''; $.each(data,function(key,val){ html =''; html+=''+val.title+''; html+=''; echodataUl.append(html); }) }) }); $('#y_maptop_sel1 p.y_right').on('click','a',function(){ var title=$('#y_maptop_sel1 p.y_right').attr('sj-city'); var datacity=$(this).attr('data-city'); var name_title=$(this).text(); $('#y_maptop_sel1 p.y_city span').text(title); $('.y_mapcond_right span.quyu em').text(name_title); $('.y_mapcond_right span.quyu a').show(); lplist(); }); y_leixing('y_maptop_sel2','a','yusuan'); y_leixing('y_maptop_sel3','a','huxing'); y_leixing('y_maptop_sel4','a','tese'); fontext('quyu','#y_maptop_sel1 p.y_city span','区域'); fontext('yusuan','#y_maptop_sel2 p.y_city span','预算'); fontext('huxing','#y_maptop_sel3 p.y_city span','户型'); fontext('tese','#y_maptop_sel4 p.y_city span','特色'); $('.y_mapcond_left a').on('click',function(){ $('.y_mapcond_right span em').html(''); $('.y_mapcond_right span a').hide(); $('#y_maptop_sel1 p.y_city span').text('区域'); $('#y_maptop_sel2 p.y_city span').text('预算'); $('#y_maptop_sel3 p.y_city span').text('户型'); $('#y_maptop_sel4 p.y_city span').text('特色'); lplist(); }) }) function fontext(name1,name2,text){ $('.y_mapcond_right').on('click','span.'+name1+' a',function(){ $(this).siblings('em').html(''); $(this).hide(); $(name2).text(text); lplist(); }) } function y_leixing(name1,name2,name3){ $('#'+name1+' p.y_leixing').on('click',name2,function(){ var title=$(this).text(); var name_title=$(this).text(); var name_title=$(this).text(); $('#'+name1+' p.y_city span').text(title); $('.y_mapcond_right span.'+name3+' em').text(name_title); $('.y_mapcond_right span.'+name3+' a').show(); lplist(); }); } function navMouseleave (id,id1){ $(id).on({ mouseover: function() { $(id1).show(); }, mouseleave: function() { $(id1).hide(); } }); } $('#y_maptop_sel1 .y_left a').on('click',function(){ $('#y_maptop_sel1 p.y_city span').text($(this).text()); var post=$(this).attr('post') var _pointx = post.split(',')[0]; var _pointy = post.split(',')[1]; point=new BMap.Point(_pointx,_pointy); mp.centerAndZoom(point, 8); mp.enableScrollWheelZoom(); lplist(); }) var mp = new BMap.Map("allmap",{maxZoom:16}); mp.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件 // mp.addControl(new BMap.OverviewMapControl({isOpen:true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT})); //右下角,打开 mp.addControl(new BMap.ScaleControl()); // 添加默认比例尺控件 mp.addControl(new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT})); // 左下 mp.addControl(new BMap.NavigationControl()); //添加默认缩放平移控件 mp.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_SMALL})); //右上角,仅包含平移和缩放按钮 point=new BMap.Point(110.483789,19.119914); mp.centerAndZoom(point, 8); mp.enableScrollWheelZoom(); var geoc = new BMap.Geocoder(); // console.log(geoc); // 复杂的自定义覆盖物 function ComplexCustomOverlay(point, text, mouseoverText){ this._point = point; this._text = text; this._overText = mouseoverText; } ComplexCustomOverlay.prototype = new BMap.Overlay(); ComplexCustomOverlay.prototype.initialize = function(map){ this._map = map; var div = this._div = document.createElement("div"); div.style.position = "absolute"; div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat); var span = this._span = document.createElement("span"); var that = this; var arrow = this._arrow = document.createElement("div"); arrow.style.background = "url(../map/image/ico_map9.png) no-repeat"; arrow.style.position = "absolute"; arrow.style.width = "24px"; arrow.style.height = "28px"; arrow.style.top = "20px"; arrow.style.left = "10px"; arrow.style.overflow = "hidden"; div.appendChild(arrow); div.onmouseover = function(){ this.style.background = "url(../map/image/ico_map9.png) no-repeat"; arrow.style.backgroundPosition = "0px -35px"; this.style.zIndex = 999999; // this.style.cursor="pointer"; } div.onmouseout = function(){ this.style.background = "url(../map/image/ico_map9.png) no-repeat"; arrow.style.backgroundPosition = "0px 0px"; this.style.zIndex = 0; } mp.getPanes().labelPane.appendChild(div); return div; } ComplexCustomOverlay.prototype.draw = function(){ var map = this._map; var pixel = map.pointToOverlayPixel(this._point); this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px"; this._div.style.top = pixel.y - 35+ "px"; }; ComplexCustomOverlay.prototype.addEventListener = function(event,fun){ this._div['on'+event] = fun; }; lplist(); function lplist(){ $(".y_mapcenter_list ul").html('') var html = ''; $.ajax({ url: "/map/js/tsconfig.json", type: "GET", dataType: "json", success: function(data) {//请求成功完成后要执行的方法 $.each(data.markerArr, function (i, data) { //左边楼盘列表 var jg=data.content.pic; if (jg!='') { jg=data.content.pic; }else{ jg='待定'; }; html+= '