?
$(function(){
var win = $(window);
var screenW = win.width();
var screenH = win.height();
var imageMarker = {
url: '/www/img/marker.png'
};
//49.050723,4.003805
//49.069867,4.053516
var LatCenter = 49.050723;
var LngCenter = 4.003805;
var draggableMAp = true;
if ((win.width() <= 320)){
draggableMAp = false;
}
var Lat = LatCenter;
var Lng = LngCenter;
var zoom = 14;
var mappyStyles = [ { "featureType": "landscape", "stylers": [ { "visibility": "on" }, { "color": "#ffffff" } ] },{ "featureType": "road", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#cccccc" } ] },{ "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "stylers": [ { "color": "#cccccc" } ] },{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "visibility": "on" }, { "color": "#000000" } ] },{ "featureType": "administrative", "elementType": "labels.text.stroke", "stylers": [ { "visibility": "on" }, { "color": "#ffffff" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "stylers": [ { "weight": 0.5 } ] },{ "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ } ]
var description = "<div id='infobullemap' style='z-index:2; color:#000; height:60px;'><br>Rue de l’industrie – 51160 AŸ - France</div>";
//var fenway = new google.maps.LatLng(48.906748,4.009259);
var fenway = new google.maps.LatLng(LatCenter,LngCenter);
var description2 = " Rue de l’industrie – 51160 AŸ - France ";
$("#carte").gmap3({
map:{
options:{
center:[LatCenter,LngCenter],
zoom: zoom,
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl:false,
zoomControl:true,
scaleControl:true,
overviewMapControl:true,
rotateControl:false,
streetViewControl: false,
center: fenway,
styles:mappyStyles,
scrollwheel: false,
draggable: draggableMAp,
zoomControl:true,
zoomControlOptions: {
style:google.maps.ZoomControlStyle.BIG,
position: google.maps.ControlPosition.LEFT_CENTER
}
},
events:{
center_changed: function(map, event, context){
window.setTimeout(function() {
//map.panTo(marker.getPosition());
var latLng = new google.maps.LatLng(LatCenter, LngCenter);
//map.panTo(latLng);
//alert("test");
}, 3000);
},
click: function(map, event, context){
// replacer la carte au centre lorsque l'on click dessus
window.setTimeout(function() {
//map.panTo(marker.getPosition());
var latLng = new google.maps.LatLng(LatCenter, LngCenter);
map.panTo(latLng);
//alert("test");
}, 0);
}
}
},
marker:{
values:[
{address:"Rue de l’industrie 51160 AŸ, France", data:"<strong>Agence Cidéo</strong> : " + description},
],
options:{
draggable: false,
icon : imageMarker,
},
events:{
click: function(marker, event, context){
var map = $(this).gmap3("get"),
infowindow = $(this).gmap3({get:{name:"infowindow"}});
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(context.data);
infoWindow.setPosition(Lat,Lng);
} else {
$(this).gmap3({
infowindow:{
anchor:marker,
options:{content: context.data, maxWidth: 200, position:(LatCenter,LngCenter)}
}
});
}
}
}
},
});
$("#replaceCenter").on('click', function(e) {
e.preventDefault();
//var map = $("#cartebrimoncourt");
replaceCenter(LatCenter,LngCenter);
});
});
replaceCenter = function(Lat,Lng){
//alert(Lat +" " + Lng);
var map = $("#carte").gmap3("get");
var latLng = new google.maps.LatLng(Lat, Lng);
map.panTo(latLng);
};