Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Вытащить картинку из JSON для Google Maps (https://javascript.ru/forum/jquery/19219-vytashhit-kartinku-iz-json-dlya-google-maps.html)

claudsp 29.07.2011 01:16

Вытащить картинку из JSON для Google Maps
 
Всем привет.

Сделал карту по этому примеру :

http://www.sitepoint.com/embellishin...s3-and-jquery/

В вылетающее окошко хочу добавить картинку.
В файле JSON следующий код :

[
{
"title": "123",
"description": "123",
"image": "http://maps.google.com/mapfiles/arrow.png",
"position": [
-37.815458,
144.952417
]
},
{
"title": "Southern Cross Station",
"description": "Did you know it used to be called Spencer St Station?",
"position": [
-37.818358,
144.952417
]
}
]

Код запроса :

$.getJSON('places.json', function(places) {
$(places).each(function() {
var place = this;



google.maps.event.addListener(marker, 'click', function() {
var hidingMarker = currentPlace;
var slideIn = function(marker) {
$('h1', info).text(place.title);
$('p', info).text(place.description);


info.animate({right: '0'});
}

marker.setIcon(icons['train-selected']);

if (currentPlace) {
currentPlace.setIcon(icons['train']);

info.animate(
{ right: '-320px' },
{ complete: function() {
if (hidingMarker != marker) {
slideIn(marker);
} else {
currentPlace = null;
}
}}
);
} else {
slideIn(marker);
}
currentPlace = marker;
});
});
});
});


Как прописать добавление картинки по URL , который находится в теге image в JSON? (Желательно чтобы она была слева от текста)
Пробовал добавить строчку

$('img', info).image(place.image) , но в результате анимация просто пропадает.

Я только начинаю разбираться с Jquery, буду рад вашей помощи.
Спасибо :)


Часовой пояс GMT +3, время: 01:26.