Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3.  
  4.  
  5. if($('#map-contact').length > 0) {
  6.  
  7. ymaps.ready(function(){
  8. map = new ymaps.Map("map-contact", {
  9. center: [55.757248755096576,37.5840621667767],
  10. controls: [],
  11. zoom: 17
  12. });
  13. map.behaviors.disable('scrollZoom');
  14. map.behaviors.disable('drag');
  15.  
  16. window.addEventListener('resize', function() {
  17. if(window.innerWidth > 576 &&window.innerWidth <= 768) {
  18. map.setCenter([55.75654694845152,37.588514633741426])
  19. } else if(window.innerWidth > 450 &&window.innerWidth <= 576) {
  20. map.setCenter([55.756280742613356,37.58837515887264])
  21. } else if(window.innerWidth > 375 &&window.innerWidth <= 450) {
  22. map.setCenter([55.75611738812743,37.58837515887264])
  23. } else if(window.innerWidth > 300 &&window.innerWidth <= 375) {
  24. map.setCenter([55.75589958107738,37.58854682024961])
  25. }
  26. })
  27.  
  28. // Создаём макет иконки.
  29. MyIconLayout = ymaps.templateLayoutFactory.createClass([
  30. '<svg width="200" height="200" style="position: absolute; top: -23px; left: -23px;">',
  31. '<use href="#sym01"/>',
  32. '</svg>',
  33. ].join('')),
  34.  
  35. myPlacemark = new ymaps.Placemark([55.759243,37.588440], {}, {
  36. iconLayout: MyIconLayout
  37. });
  38.  
  39.  
  40. map.geoObjects
  41. .add(myPlacemark);
  42.  
  43.  
  44.  
  45. });
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. }
  55.  
  56. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement