[jQuery] Google Maps / JQuery
Hello,
i´m using JQuery. Overall no problem... just with Google Maps it does
not work at all.
While loading the code attached in the <head></head> area, all other
JQuery Code stop working and are reported as error.
Anybody who can fix this ? Thanks alot.
For example:
-----
$("#login-box") has no properties
(no name)()test.js (line 19)
e()jquery.js (line 11)
e()jquery.js (line 11)
e([function(), function()], function(), undefined)jquery.js (line 11)
e()jquery.js (line 11)
[Break on this error] $("#login-box").hide();
-----
Code
-----
<script src="http://maps.google.com/maps?
file=api&v=2&key={gmaps_key}" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
window.onload=load
function load()
{
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
geocoder = new GClientGeocoder();
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
var posi = new GLatLng({gmaps_lat}, {gmaps_long});
map.setCenter(posi, 13);
map.addOverlay(new GMarker(posi));
GEvent.addListener(map, "click", function(marker, point) {
if (marker) {
map.removeOverlay(marker);
} else {
map.clearOverlays();
map.addOverlay(new GMarker(point));
updateGeo(point.x, point.y);
}
});
}
}
function showAddress() {
var street = document.useraddress.address.value;
var zipcode = document.useraddress.zipcode.value;
var city = document.useraddress.city.value;
var countries = document.useraddress.country;
var country = countries.options[countries.selectedIndex].innerHTML;
var address = "";
var sep = "";
if(street) {address += sep + street; sep = ", ";}
if(zipcode) {address += sep + zipcode; sep = ", ";}
if(city) {address += sep + city; sep = ", ";}
if(country) {address += sep + country; sep = ", ";}
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " nicht gefunden");
} else {
//map.setCenter(point, 13);
map.clearOverlays();
var marker = new GMarker(point);
map.addOverlay(marker);
updateGeo(point.x, point.y);
//marker.openInfoWindowHtml(address);
}
}
);
}
function updateGeo(long, lat) {
assignFieldValue('gmaps_lat',lat);
assignFieldValue('gmaps_long',long);
map.setCenter(new GLatLng(lat, long));
}
//]]>
</script>
-----