Advertisement
asimryu

korea.php

Jul 12th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.61 KB | None | 0 0
  1. <?php include("header.php"); ?>
  2. <h2>Korea Map</h2>
  3. <div class="row">
  4.     <div id="korea" class="col-md-8"></div>
  5.     <div class="col-md-4">
  6.         <h2 id="name_ko"></h2>
  7.     </div>
  8. </div>
  9.  
  10. <script>
  11.     var data = [];
  12.     $.getJSON("svgkorea/korea.json",function(d){
  13.         data = d.korea.city;
  14.         //console.log(data);
  15.     });
  16.  
  17.     $("#korea").load("svgkorea/korea.svg");
  18.     $("#korea").on("click",".land",function(){
  19.         var id = $(this).attr("id");
  20.         var info = data.filter(function(cities){
  21.             return cities.id === id;
  22.         });
  23.         var city = info[0];
  24.         $("#name_ko").html(city.name_ko);
  25.     });
  26. </script>
  27. <?php include("footer.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement