SYNCERのロゴ
アイキャッチ画像

Circle: clickable

clickableはCircleクラスのオプションです。円のクリックの有効、無効を調整します。

boolean

trueならクリックが有効、falseなら無効になる。

var opts = {
	clickable: false ,
} ;

デモ

clickableを指定したデモです。円にホバーした時のマウスカーソルの形状の変化で、有効、無効を確認して下さい。

カスタム

var circle = new google.maps.Circle( {
	map: map ,
	center: map.getCenter() ,
	radius: 8000 ,
	clickable: false ,
} ) ;

デフォルト

var circle = new google.maps.Circle( {
	map: map ,
	center: map.getCenter() ,
	radius: 8000 ,
} ) ;

サンプルコード

<!DOCTYPE html>
<html>
<head>
	<style>
#map-canvas {
	width: 600px ;
	height: 600px ;
}
	</style>
</head>
<body>
	<div id="map-canvas"></div>

	<script src="//maps.googleapis.com/maps/api/js?key={APIキー}"></script>
	<script>
var mapDiv = document.getElementById( "map-canvas" ) ;

// Map
var map = new google.maps.Map( mapDiv, {
	center: new google.maps.LatLng( 35, 139 ) ,
	zoom: 11 ,
} ) ;

// Circle
var circle = new google.maps.Circle( {
	map: map ,
	center: new google.maps.LatLng( 35, 139 ) ,
	radius: 8000 ,
	clickable: false ,
} ) ;

// fit bounds
map.getBounds( circle.getBounds() ) ;
	</script>
</body>
</html>

デモページを開く

  • Twitterでシェア
  • Facebookでシェア
  • Google+でシェア
  • はてなブックマークでシェア
  • pocketに保存
  • LINEでシェア
更新履歴
2015年9月1日 (火)
コンテンツを公開しました。