2013-08-06 1 views

답변

0

글쎄, 어쩌면 당신이 jvectormap이 지역에 현재 마우스의 위치와 일치 방법을 살펴 수 있습니다 - 당신은 당신의 위도와 일치 할 수 있어야한다/LNG 내가 그 일을하는 방법을 발견

0

유사한 방법으로 좌표 , 그러나 그것은 정말로 hackish하고, 나는 그것을하는 더 좋은 방법이 있다고 확신합니다.

어쨌든, 문제는 여기에 내 솔루션입니다 :

jvm.Map.prototype.latLngToRegion = function (lat, lng) { 
     var pointOnMap = this.latLngToPoint(lat, lng), 
      pointOnPage = { 
       x: Math.round((pointOnMap.x + this.container.offset().left) - $(window).scrollLeft()), 
       y: Math.round((pointOnMap.y + this.container.offset().top) - $(window).scrollTop()) 
      }, 
      element = document.elementFromPoint(pointOnPage.x, pointOnPage.y), 
      region = $(element).attr('data-code'); 

     return region; // note, this will only give you the region code, but from that you can read out most of what you need from jvectormaps itself. 
    } 

주의 사항은 document.elementFromPoint가 작동하려면,보기에 있어야의 위도와 경도는 당신이 찾고있는 수 있습니다. 하지만 스크롤 및지도 팬 등에서 목록을 업데이트 할 수 있습니다.