Answer the question
In order to leave comments, you need to log in
How to resolve the conflict between Yandex maps and jQuery scripts?
Hello!
I made a sliding menu in Jquery:
$(document).ready(function(){
$('#menu > li'){
.hide()
.click(function(e){
e.stopPropagation();
}
}
});
$('#menu > li').toggle(function(){
$(this).find('ul').slideDown();
}, function(){
$(this).find('ul').slideUp();
});
});
var myMap;
ymaps.ready(init); // Ожидание загрузки API с сервера Яндекса
function init () {
var myMap = new ymaps.Map('map', {
center: [5,12],
zoom: 12,
}, {
searchControlProvider: 'yandex#search'
}),
// Создаем геообъект с типом геометрии "Точка".
myGeoObject = new ymaps.GeoObject({
// Описание геометрии.
geometry: {
type: "Point",
coordinates: [15,94.14841]
},
// Свойства.
properties: {
// Контент метки.
}
}, {
// Опции.
// Иконка метки будет растягиваться под размер ее содержимого.
preset: 'islands#blackStretchyIcon',
// Метку можно перемещать.
draggable: true
});
myMap.controls.add('smallZoomControl');
myMap.controls.add('typeSelector');
myMap.geoObjects
.add(myGeoObject)
.add(new ymaps.Placemark([58, 32], {
hintContent: 'Проспект Энгельса'
}, {
preset: 'islands#circleIcon',
iconColor: '#4d7198'
}))
.add(new ymaps.Placemark([12,49], {
hintContent: 'Третья улица Строителей'
}, {
preset: 'islands#circleDotIcon',
iconColor: '#1faee9'
}));
}
Answer the question
In order to leave comments, you need to log in
I eliminated some of the errors from the consoles - one of them was very interesting, it was necessary to disable the adblock)
In general, the problem is solved - everything turned out, as usual, much easier. All you had to do was swap
<script src="http://yandex.st/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
<script src="http://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<script src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU" type="text/javascript"></script>
<script src="js/jquery-1.6.3.min.js"></script>
<link href="fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet">
<script src="fancybox/jquery.fancybox-1.3.4.min.js"></script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question