Skip to content

Commit

Permalink
#25 Provide a way to hide and show the map, without redrawing it
Browse files Browse the repository at this point in the history
#19 Remove Markers Function
  • Loading branch information
EddyVerbruggen committed Aug 24, 2016
1 parent d1040ff commit 788eef9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ And here's the comprehensive list of supported functions:
disableZoom: false, // default false
markers: [ // optional without a default
{
id: 1, // can be user in 'removeMarkers()'
lat: 52.3732160, // mandatory
lng: 4.8941680, // mandatory
title: 'Nice location', // recommended to pass in
Expand All @@ -92,6 +93,14 @@ Also, all functions support promises, but we're leaving out the `.then()` stuff
mapbox.hide();
```

### unhide
If you previously called `hide()` you can quickly unhide the map,
instead of redrawing it (which is a lot slower and you loose the viewport position, etc).

```js
mapbox.unhide();
```

### addMarkers
```js
var onTap = function(marker) {
Expand All @@ -103,6 +112,7 @@ Also, all functions support promises, but we're leaving out the `.then()` stuff

mapbox.addMarkers([
{
id: 2, // can be user in 'removeMarkers()'
lat: 52.3602160, // mandatory
lng: 4.8891680, // mandatory
title: 'One-line title here', // no popup unless set
Expand All @@ -117,6 +127,18 @@ Also, all functions support promises, but we're leaving out the `.then()` stuff
])
```

### removeMarkers
You can either remove all markers by not passing in an argument,
or remove specific marker id's (which you specified previously).

```js
// remove all markers
mapbox.removeMarkers();

// remove specific markers by id
mapbox.removeMarkers([1, 2]);
```

### setCenter
```js
mapbox.setCenter(
Expand Down

0 comments on commit 788eef9

Please sign in to comment.