2014-10-13 1 views
1

javectmap을 표시하거나 식별하여 항목에서 기능 변경을 호출 할 수 있습니까? 내 경우 , 나는이 jvectormap과 (지도 만점) 버튼, 나는 그것이 내가 버튼을 클릭하면 같은 일이 원하는이의 jvectormap의 "markersSelectable은"참으로 변경할 수 있습니다jvectormap을 표시하거나 표시하는 방법

<!DOCTYPE html> 
<html> 
<head> 
    <title>jVectorMap demo</title> 
    <link rel="stylesheet" href="jquery-jvectormap-1.0.css" type="text/css" media="screen"/> 
    <script src="jquery.js"></script> 
    <script src="jquery-jvectormap-1.0.min.js"></script> 
    <script src="jquery-jvectormap-world-mill-en.js"></script> 
</head> 
<body> 
    <form><input id="pan" type="button" value="Pan" /></form> 
    <div id="world-map" style="width: 600px; height: 400px"></div> 
    <script> 
    $(function(){ 
     $('#world-map').vectorMap(
     map: 'world_mill_en' 
    ); 
     $('#pan').click(function() { 
     //change the jvectormap attribute "markersSelectable" to true 
     }); 
    }); 
    </script> 
</body> 
</html> 

답변

0

에 시도 요소를 비우고 새로운 속성으로 다시로드하십시오. 제 경험상 잘 작동합니다.

<script> 
     $(function(){ 
      $('#world-map').vectorMap(
      map: 'world_mill_en' 
     ); 
      $('#pan').click(function() { 
      var map_object = $('#world-map').vectorMap('get', 'mapObject'); 
      map_object.params.markersSelectable = false; 
      }); 
     }); 
     </script> 

btw, 사용하고자하는 1.2.2 버전이 있습니다.

+0

감사합니다.하지만 제 경우에는 vectormap에 많은 다른 콘텐츠가 있습니다. 따라서 두 번째 코드를 입력하여지도를 다시로드하지는 않을 것입니다. 사건을 명확히 밝히지 않아서 죄송합니다. – YY1988

+0

@ YY1988 편집 내용을 확인하고 효과가 있는지 확인하십시오. – NewInTheBusiness

+0

놀랍습니다. 정상적으로 작동합니다! 정말 고맙습니다! – YY1988

관련 문제