I want to put action listener on the zoom in button of my website,so that when map moves(zoom in) map 2 also zoom in.I had tried the moveend function but that doesnt worked out.How can I do that?
You can do this by the zoom_changed function:
//Zooming
google.maps.event.addListener(map,'zoom_changed', function ()
{
var newCenter1 = map.getCenter();
var z=map.getZoom();
map1.setZoom(z);
});
Related
To change the color of the calendar after processing.
Instead of changing the color of the initial state, we want to change the color of certain events later.
function change_color(event_id){
.....
change color event
}
$(document).ready(function () {
$('#calendar').fullCalendar({
.......
});
});
You can use the eventRender callback to bind a click function or whatever you want to the event elements. In this codepen example I have added a click function that when an event is clicked it will change the color to green with css. You can also access the event properties to do something like event.color = 'green', which will not update on the calendar but could be useful for updating the event in the database.
eventRender: function(event, element, view) {
element.bind('click', function() {
$(this).css('background-color', 'green');
});
}
I'm using something like this (javascript):
google.maps.event.addDomListener(new_marker, 'click', function(e) {
alert("hi");
});
But I don't want it to trigger when the user moves the map, and they just happened to do so while clicking on the marker. To be clear: I only want the code to run when the user clicked on the marker, without moving the map. How can I do that?
I'm adding some info windows on my map with clicking button:
$(document).ready(function() {
$("input:#ekle").click(function(){//balon ekle ve listeye ekle
infoWindow3 = new google.maps.InfoWindow();
var en=$("input:#x").val();
var boy=$("input:#y").val();
var yazi=$("input:isim2").val();
var windowLatLng3 = new google.maps.LatLng(en,boy);
infoWindow3.setOptions({
content: yazi,
position: windowLatLng3,
});
infoWindow3.open(map);
ekle(yazi);//adding Infowindow contecnt(value) to listbox
});
So I can creating InfoWindows.Now I will closing my InfoWindow with clicking an other button :
function cikar(){//listeden cikarma
var cikarilacak=$('#liste option:selected').val();//looking listbox selected item value
$("#liste option[value='"+cikarilacak+"']").remove();
//at this step I will close my InfoWındow where I selected it's value from listbox
}
I will close InfoWindow which I selected it's value from listbox.what can I do
pass the infoWindow-instance as argument to the function that creates the option.
When you create the option, store the reference to the infoWindow with the option(you e.g. may use $.data()).
It's easy then to retrieve the reference to the infoWindow in cikar() and to close the infoWindow.
Each time the mouse is moving over a marker I display an infowindow:
var optionMarker = {position:point, map:map,icon:image,shadow:ombre};
var marker = new g.Marker(optionMarker);
var infowindow = new g.InfoWindow({content: texte});
g.event.addListener(marker, 'mouseover', function()
{
infowindow.open(map,marker);
});
If I click several markers, then I have several opened infowindows.
These infowindows are superposed.
Which could be the better way to move from a infowindow to another infowindow ?
- by clicking the selected infowindow ?
The InfoWindows don't seem to have any events associated with them (click, mouseover, etc) so the next best thing, I think, is to manipulate the markers. I set up the markers so that when the mouse is over them, the linked InfoWindow rises to the top.
http://jsfiddle.net/XCCSL/
I need to trigger an event when the user drops a marker on the map. I have the code working for them to drop the marker, but I can't figure out how to trigger the event.
Any tips?
With Marker event dragend you have the latlng where the Marker is drop. This is that you need?
google.maps.event.addListener(Marker, "dragend", function(event) {
var lat = event.latLng.lat();
var lng = event.latLng.lng();
});