Skip to content

Commit

Permalink
Rework fully README
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeh committed Jun 7, 2013
1 parent 29733c2 commit 19e1520
Showing 1 changed file with 40 additions and 26 deletions.
66 changes: 40 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,33 @@ L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {

##onAdd

To benefit from the bouncing effect when adding your marker, you must set
bounceOnAdd option when initializing your Marker:
Make your marker bounce when you add them to a map.

```javascript
L.marker([48.85, 2.35], { bounceOnAdd: true }).addTo(map);
L.marker([48.85, 2.35], boolean bounceOnAdd, object bounceOnAddOptions).addTo(map);
```

If you don't want your Marker to bounce on add, simply ignore the option to
obtain the default behavior:
###bounceOnAdd (boolean) (optionnal)

```javascript
L.marker([48.85, 2.35]).addTo(map);
```
If true, your marker will bounce when added to the map. Default to false.

###bounceOnAddOptions (object) (optionnal)

* bounceOnAddDuration (integer) (Default: 1000)

The duration of the animation in milliseconds.

* bounceOnAddHeight (integer) (Default: top_y)

You can also pass some options arguments as an object to customise the animation:
The height (in pixel) at which the marker is "dropped".
The default is the top point on the y axis of the Marker.

**Example:**
```javascript
// take 500ms to bounce from 100px height
L.marker([48.85, 2.35], { bounceOnAdd: true, bounceOnAddOptions: {duration: 500, height: 100} }).addTo(map);
```

**DEPRECATED METHOD**

You can also use the optional bounceOnAddDuration and bounceOnAddHeight
arguments to customise the animation:
**DEPRECATED**

```javascript
// take 500ms to bounce from 100px height
Expand All @@ -59,23 +62,34 @@ L.marker([48.85, 2.35], { bounceOnAdd: true, bounceOnAddDuration: 500, bounceOnA

##bounce

You can also use the ``bounce()`` function to make a marker bounce, when you
want it to (you can also pass an object to customise the animation):
Make a marker bounce at anytime you wish.

```javascript
L.marker([48.85, 2.35])
.addTo(map)
.on('click', function () {
this.bounce({
duration: 500,
height: 100
});
});
bounce(object options, function callback);
```

**DEPRECATED METHOD**
###options (object) (optionnal)

* duration (integer) (Default: 1000)

The duration of the animation in milliseconds.

* height (integer) (Default: top_y)

The height (in pixel) at which the marker is "dropped".
The default is the top point on the y axis of the Marker.

###callback (function) (optionnal)

If you specify the callback parameter, it will be called at the end of the
animation.

**Example:**
```javascript
marker.bounce({duration: 500, height: 100}, function(){console.log("done")});
```

You can also pass arguments to bounce() to customise the marker's animation:
**DEPRECATED**

```javascript
L.marker([48.85, 2.35])
Expand Down

0 comments on commit 19e1520

Please sign in to comment.