質問するログイン新規登録

回答編集履歴

3

セミコロン追加

2016/02/22 07:17

投稿

yamato_hikawa
yamato_hikawa

スコア2092

answer CHANGED
@@ -5,7 +5,7 @@
5
5
  var createShopMarker = function(option) {
6
6
  this.shop = new google.maps.Marker(option);
7
7
  this.init();
8
- }
8
+ };
9
9
 
10
10
  createShopMarker.prototype = {
11
11
  init: function() {
@@ -26,7 +26,7 @@
26
26
  openInfo: function(){
27
27
  this.infoWindow.open(this.map, this.shop);
28
28
  }
29
- }
29
+ };
30
30
 
31
31
  // 実行
32
32
  var shop1 = new createShopMarker({

2

修正

2016/02/22 07:17

投稿

yamato_hikawa
yamato_hikawa

スコア2092

answer CHANGED
@@ -9,10 +9,10 @@
9
9
 
10
10
  createShopMarker.prototype = {
11
11
  init: function() {
12
- var contentString = this.shop.title;
12
+ this.title = this.shop.title;
13
-
13
+ this.map = this.shop.map;
14
14
  this.infoWindow = new google.maps.InfoWindow({
15
- content: contentString
15
+ content: this.title
16
16
  });
17
17
  this.bindEvent();
18
18
  },
@@ -24,7 +24,7 @@
24
24
  });
25
25
  },
26
26
  openInfo: function(){
27
- this.infoWindow.open(map, this.shop);
27
+ this.infoWindow.open(this.map, this.shop);
28
28
  }
29
29
  }
30
30
 

1

修正

2016/02/22 05:19

投稿

yamato_hikawa
yamato_hikawa

スコア2092

answer CHANGED
@@ -29,14 +29,14 @@
29
29
  }
30
30
 
31
31
  // 実行
32
- var shop1 = createShopMarker({
32
+ var shop1 = new createShopMarker({
33
33
  position: new google.maps.LatLng(座標),
34
34
  map: map,
35
35
  icon: 'images/icon1.png',
36
36
  title: '場所1'
37
37
  });
38
38
 
39
- var shop2 = createShopMarker({
39
+ var shop2 = new createShopMarker({
40
40
  position: new google.maps.LatLng(座標),
41
41
  map: map,
42
42
  icon: 'images/icon2.png',