Guest User

Untitled

a guest
Aug 14th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. var myloc = new L.LatLng(13.7433242, 100.5421583);
  2. var myloc1 = new L.LatLng(14.979900, 102.097771);
  3. $(function () {
  4. var circle;
  5. var slider = document.getElementById('myRange');
  6. var output = document.getElementById('demo');
  7. output.innerHTML = slider.value + scale;
  8.  
  9. slider.oninput = function (val) {
  10. output.innerHTML = this.value + scale;
  11. circle.setRadius(this.value);
  12. }
  13.  
  14. circle = L.circle(myloc, {
  15. color: '#7a7777',
  16. weight: 0.1,
  17. fillColor: '#7a7777',
  18. fillOpacity: 0.2,
  19. radius: 0
  20. }).addTo(map);
  21.  
  22. $('.btn-a').on('click', function(e){
  23. if ($(this).val() == 'First') {
  24. circle = L.circle(myloc, {
  25. color: '#7a7777',
  26. weight: 0.1,
  27. fillColor: '#7a7777',
  28. fillOpacity: 0.2,
  29. radius: 0
  30. }).addTo(map);
  31.  
  32. } else if($(this).val() == 'Second') {
  33. circle = L.circle(myloc1, {
  34. color: '#7a7777',
  35. weight: 0.1,
  36. fillColor: '#7a7777',
  37. fillOpacity: 0.2,
  38. radius: 0
  39. }).addTo(map);
  40. }
  41. });
  42. });
  43.  
  44. const circles = {
  45. First: myloc,
  46. Second: myloc1
  47. }
  48.  
  49. L.circle(circles[$(this).val()], {
  50. color: '#7a7777',
  51. weight: 0.1,
  52. fillColor: '#7a7777',
  53. fillOpacity: 0.2,
  54. radius: 0
  55. }).addTo(map)
Add Comment
Please, Sign In to add comment