помогите преобразовать javascript в jquery
Здравствуйте, очень нужна помощь.
Есть javascript функции (внутри <script></script>работали, после переноса их в плагин jquery - перестали):
geocoder.geocode( { 'address': options.address }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker.setPosition(results[0].geometry.location);
}
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
помогите их преобразовать в jquery. после переноса кода из обычного скрипта javascript в плагин jquery эти функции не отрабатывают. большая просьба помочь. вот полный код плагина:
(function($){
$.fn.addressMap = function(options) {
var opts = $.extend({
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP
}, options);
var geocoder = new google.maps.Geocoder();
var map = new google.maps.Map($(this), opts);
geocoder.geocode( { 'address': options.address }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker.setPosition(results[0].geometry.location);
}
});
var infowindow = new google.maps.InfoWindow({
content: options.address
});
var marker = new google.maps.Marker({
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
//return this
}
})(jQuery);
|
готово
|
| Часовой пояс GMT +3, время: 22:52. |