Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
  <script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAWsjzTMBDUFO6JFmxkdH7ghXv0aacLb84&callback=initMap">
</script>
<script>
function initMap() {
  var uluru = {
    lat: 25.26393,
    lng: 55.386004
  };
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 16,
    center: uluru
  });
  var marker = new google.maps.Marker({
    position: uluru,
    map: map
  });
  var winWidth = $(window).width();
  panMap();
  $(window).resize(function() {
    map.setCenter(uluru);
    panMap();
  });
  google.maps.event.addListener(map, 'zoom_changed', function() {
    map.panTo(uluru);
    panMap();
  });
  
  function panMap(xChange){
    var winWidth = $(window).width();
    if(winWidth > 671){
      map.panBy(xChange || -170, 0);
    }
  }
}
</script>
<div id="map"></div>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers