$(function(){ // Geolocation APIを利用できるかをチェック if (navigator.geolocation) { // 現在位置を取得 navigator.geolocation.getCurrentPosition( // 取得に成功したら、経度/緯度を変数currentに設定 function (pos) { var current = [ pos.coords.latitude, pos.coords.longitude ]; // Googleマップの操作を開始 $('#map').gmap3( *1* // 初期化処理 { action : 'init', options : { center : current, // 中央座標 zoom : 15 // ズーム率 } }, // マーカーの追加 { action : 'addMarker', latLng : current // マーカーの座標 }, // 円の描画 { action : 'addCircle', center : current, // 円中心の座標 radius : 500, // 半径(m) fillColor : '#CFF', // 塗りつぶし色 strokeColor : '#36f' // 枠線の色 } ); } ); } else { alert('ブラウザがGeolocation APIに対応していません。'); } });