This is a fully functional code which may satisfy your requirements:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
center: myLatlng,
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
google.maps.event.addListener(map, 'center_changed', function() {
// 0.1 seconds after the center of the map has changed,
// set back the marker position.
window.setTimeout(function() {
var center = map.getCenter();
marker.setPosition(center);
}, 100);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body><div id="map-canvas"/></body></html>