pins.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>JQVMap - World Map</title>
  6. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  7. <link href="../dist/jqvmap.css" media="screen" rel="stylesheet" type="text/css"/>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. #overlay {
  14. position: relative;
  15. overflow: hidden;
  16. }
  17. #overlay div {
  18. position: absolute;
  19. z-index: 1;
  20. }
  21. .jqvmap-zoomin,
  22. .jqvmap-zoomout {
  23. z-index: 1;
  24. }
  25. .pin {
  26. background: url(images/tip.png) no-repeat;
  27. width: 9px;
  28. height: 5px;
  29. position: absolute;
  30. cursor: pointer;
  31. pointer-events: none;
  32. }
  33. .pin .pin_content {
  34. background: url("images/background.png") repeat scroll 0 0 transparent;
  35. border-radius: 5px 5px 5px 5px;
  36. bottom: 50px;
  37. height: 50px;
  38. position: relative;
  39. right: 15px;
  40. width: 100px;
  41. }
  42. .pin .pin_content div {
  43. float: left;
  44. height: 30px;
  45. width: 35px;
  46. padding: 10px 5px;
  47. text-align: center;
  48. }
  49. .pin .pin_content div span {
  50. color: #EA4E41;
  51. font-size: 20px;
  52. font-weight: bold;
  53. line-height: 18px;
  54. }
  55. .pin .pin_content div span.small {
  56. font-size: 12px;
  57. }
  58. .pin .pin_content .thumb {
  59. width: 45px;
  60. }
  61. .pin .pin_content .thumb img {
  62. max-width: 45px;
  63. max-height: 30px;
  64. }
  65. #rightcol {
  66. position: absolute;
  67. right: 230px;
  68. top: 0;
  69. }
  70. table, tr, td {
  71. border: 1px solid #aaaaaa;
  72. }
  73. .pin-td {
  74. height: 65px;
  75. padding: 20px;
  76. width: 70px;
  77. }
  78. </style>
  79. <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
  80. <script src="../dist/jquery.vmap.js" type="text/javascript"></script>
  81. <script src="../dist/maps/jquery.vmap.world.js" type="text/javascript"></script>
  82. <script type="text/javascript">
  83. var pins = {
  84. 'ru': "\u003ca target=\"_blank\" href=\"http://www.google.com.ru\"\u003epin_ru\u003c/a\u003e",
  85. 'pk': "\u003ca target=\"_blank\" href=\"http://www.google.com.pk\"\u003epin_pk\u003c/a\u003e"
  86. };
  87. jQuery(document).ready(function () {
  88. jQuery('#vmap').vectorMap({
  89. map: 'world_en',
  90. backgroundColor: '#333333',
  91. color: '#ffffff',
  92. hoverOpacity: 0.7,
  93. selectedColor: '#666666',
  94. enableZoom: true,
  95. showTooltip: true,
  96. scaleColors: ['#C8EEFF', '#006491'],
  97. normalizeFunction: 'polynomial',
  98. pins: {
  99. "ru": "\u003ca href=\"http://google.com\"\u003epin_ru\u003c/a\u003e",
  100. "pk": "\u003ca href=\"http://google.com\"\u003epin_pk\u003c/a\u003e"
  101. }
  102. });
  103. });
  104. function placePin(id) {
  105. id = id.toLowerCase();
  106. var cc = jQuery("#" + id + ' input[name=cc]').val();
  107. if (cc == '') {
  108. alert('Insert a country code first');
  109. return;
  110. }
  111. var pin = jQuery("#" + id + ' .pin-td').html();
  112. if (jQuery.trim(pin) == '') {
  113. alert('Pin has been moved');
  114. return;
  115. }
  116. var pins = new Object();
  117. pins[cc] = pin;
  118. jQuery('#vmap').vectorMap('placePins', pins, 'content');
  119. }
  120. function movePin(id) {
  121. id = id.toLowerCase();
  122. var cc = jQuery("#" + id + ' input[name=cc]').val();
  123. if (cc == '') {
  124. alert('Insert a country code first');
  125. return;
  126. }
  127. var pin = jQuery("#" + id + ' .pin-td').html();
  128. if (jQuery.trim(pin) == '') {
  129. alert('Pin has been moved');
  130. return;
  131. }
  132. pin = id + '_content';
  133. var pins = new Object();
  134. pins[cc] = pin;
  135. jQuery('#vmap').vectorMap('placePins', pins, 'id');
  136. }
  137. function removePin() {
  138. var cc = jQuery('#remove input[name=cc]').val();
  139. if (cc == '') {
  140. alert('Insert a country code first');
  141. return;
  142. }
  143. jQuery('#vmap').vectorMap('removePin', cc);
  144. }
  145. function removeAllPins() {
  146. jQuery('#vmap').vectorMap('removePins');
  147. }
  148. </script>
  149. </head>
  150. <body>
  151. <div id="vmap" style="width: 600px; height: 400px;"></div>
  152. <div id="rightcol">
  153. <table>
  154. <tr id="pin1">
  155. <td class="pin-td">
  156. <div id="pin1_content" class="pin">
  157. <div class="pin_content">
  158. <div>
  159. <span>09</span>
  160. <span class="small">new</span>
  161. </div>
  162. <div class="thumb">
  163. <img src="images/thumb.jpg"/>
  164. </div>
  165. </div>
  166. </div>
  167. </td>
  168. <td>
  169. <input type="text" name="cc" placeholder="Country code"/><br/>
  170. <input type="button" onClick="placePin('pin1')" value="Copy"/>
  171. <input type="button" onClick="movePin('pin1')" value="Move"/>
  172. </td>
  173. </tr>
  174. <tr id="pin2">
  175. <td class="pin-td">
  176. <img id="pin2_content" src="images/globe.png"/>
  177. </td>
  178. <td>
  179. <input type="text" name="cc" placeholder="Country code"/><br/>
  180. <input type="button" onClick="placePin('pin2')" value="Copy"/>
  181. <input type="button" onClick="movePin('pin2')" value="Move"/>
  182. </td>
  183. </tr>
  184. <tr id="pin3">
  185. <td class="pin-td">
  186. <img id="pin3_content" src="images/flag.png"/>
  187. </td>
  188. <td>
  189. <input type="text" name="cc" placeholder="Country code"/><br/>
  190. <input type="button" onClick="placePin('pin3')" value="Copy"/>
  191. <input type="button" onClick="movePin('pin3')" value="Move"/>
  192. </td>
  193. </tr>
  194. <tr id="remove">
  195. <td class="pin-td">
  196. <input type="text" name="cc" placeholder="Country code"/><br/>
  197. <input type="button" onClick="removePin()" value="Remove"/>
  198. </td>
  199. <td>
  200. <input type="button" onClick="removeAllPins()" value="Remove"/>
  201. </td>
  202. </tr>
  203. </table>
  204. </div>
  205. </body>
  206. </html>